1- # Material Library  Localizations  
1+ # Material and Cupertino Libraries  Localizations  
22
33The ` .arb `  files in this directory contain localized values (primarily
4- strings) used by the material library.  The ` localizations.dart `  file
5- combines all of the localizations into a single Map that is
6- linked with the rest of flutter_localizations package.
4+ strings) used by the Material and Cupertino libraries.  The
5+ ` generated_material_localizations.dart `  and
6+ ` generated_cupertino_localizations.dart `  files combine all of the
7+ localizations into a single Map that is linked with the rest of
8+ flutter_localizations package.
79
810If you're looking for information about internationalizing Flutter
911apps in general, see the
@@ -12,17 +14,17 @@ apps in general, see the
1214
1315### Translations for one locale: .arb files  
1416
15- The Material library uses 
17+ The Material and Cupertino libraries use 
1618[ Application Resource Bundle] ( https://code.google.com/p/arb/wiki/ApplicationResourceBundleSpecification ) 
1719files, which have a ` .arb `  extension, to store localized translations
1820of messages, format strings, and other values. This format is also
1921used by the Dart [ intl] ( https://pub.dartlang.org/packages/intl ) 
2022package and it is supported by the
2123[ Google Translators Toolkit] ( https://translate.google.com/toolkit ) .
2224
23- The material library  only depends  on a small subset of the ARB format. 
24- Each .arb file contains a single JSON table that maps from resource 
25- IDs to localized values.
25+ The Material and Cupertino libraries  only depend  on a small subset
26+ of the ARB format.  Each .arb file contains a single JSON table that
27+ maps from resource  IDs to localized values.
2628
2729Filenames contain the locale that the values have been translated
2830for. For example ` material_de.arb `  contains German translations, and
@@ -36,8 +38,8 @@ an additional file with a regional suffix is present, the regional
3638localizations are automatically merged with the language-specific ones.
3739
3840The JSON table's keys, called resource IDs, are valid Dart variable
39- names. They correspond to methods from the ` MaterialLocalizations ` 
40- class . For example:
41+ names. They correspond to methods from the ` MaterialLocalizations `  or 
42+ ` CupertinoLocalizations `  classes . For example:
4143
4244``` dart 
4345Widget build(BuildContext context) { 
@@ -59,17 +61,21 @@ generated `localizations.dart` file. The Map is used by the
5961MaterialLocalizations class.
6062
6163
62- ### material_en.arb Defines  all of the resource IDs  
64+ ### material_en.arb and cupertino_en.arb Define  all of the resource IDs  
6365
64- All of the ` .arb `  files whose names do not include a regional suffix 
65- contain translations for the same set of resource IDs as
66+ All of the ` material_* .arb`  files whose names do not include a regional
67+ suffix  contain translations for the same set of resource IDs as
6668` material_en.arb ` .
6769
68- For each resource ID defined for English in material_en.arb, there is
69- an additional resource with an '@' prefix. These '@' resources are not
70- used by the material library at run time, they just exist to inform
71- translators about how the value will be used, and to inform the code
72- generator about what code to write.
70+ Similarly all of the ` cupertino_*.arb `  files whose names do not include
71+ a regional suffix contain translations for the same set of resource IDs
72+ as ` cupertino_en.arb ` .
73+ 
74+ For each resource ID defined for English, there is an additional resource
75+ with an '@' prefix. These '@' resources are not used by the generated
76+ Dart code at run time, they just exist to inform translators about how
77+ the value will be used, and to inform the code generator about what code
78+ to write.
7379
7480``` dart 
7581"cancelButtonLabel": "CANCEL", 
@@ -83,8 +89,8 @@ generator about what code to write.
8389### Values with Parameters, Plurals  
8490
8591A few of material translations contain ` $variable `  tokens. The
86- material library replaces  these tokens with values at run-time. For 
87- example:
92+ Material and Cupertino libraries replace  these tokens with values at
93+ run-time. For  example:
8894
8995``` dart 
9096"aboutListTileTitle": "About $applicationName", 
@@ -97,7 +103,7 @@ method instead of a simple getter:
97103MaterialLocalizations.of(context).aboutListTileTitle(yourAppTitle) 
98104``` 
99105
100- The names of the ` $variable `  tokens match the names of the
106+ The names of the ` $variable `  tokens must  match the names of the
101107` MaterialLocalizations `  method parameters.
102108
103109
@@ -123,11 +129,15 @@ the "Other" suffix. For example the English translations
123129"selectedRowCountTitleOther": "$selectedRowCount items selected", 
124130``` 
125131
132+ When defining new resources that handle pluralizations, the "One" and
133+ the "Other" forms must, at minimum, always be defined in the source
134+ English ARB files.
126135
127- ### scriptCategory and timeOfDayFormat  
136+ ### scriptCategory and timeOfDayFormat for Material library   
128137
129- The values of these resource IDs are not translations, they're keywords that
130- help define an app's text theme and time picker layout respectively.
138+ In ` material_en.arb ` , the values of these resource IDs are not
139+ translations, they're keywords that help define an app's text theme
140+ and time picker layout respectively.
131141
132142The value of ` timeOfDayFormat `  defines how a time picker displayed by
133143[ showTimePicker()] ( https://docs.flutter.io/flutter/material/showTimePicker.html ) 
@@ -145,43 +155,43 @@ section in the Material spec. The Material theme uses the
145155[ Typography.geometryThemeFor] ( https://docs.flutter.io/flutter/material/Typography/geometryThemeFor.html ) .
146156
147157
148- ### Generated file localizations .dart: all of the localizations as a Map 
158+ ### 'generated _ * _ localizations .dart' : all of the localizations as a Map 
149159
150- If you look at the comment at the top of ` localizations.dart `  you'll
151- see that it was manually generated using a ` dev/tools/localization `  app called
152- ` gen_localizations ` .
160+ If you look at the comment at the top of the ` generated_material_localizations.dart ` 
161+ and ` generated_cupertino_localizations.dart `  files, you'll
162+ see that it was manually generated using a ` dev/tools/localizations ` 
163+ app called ` gen_localizations ` .
153164
154165You can see what that script would generate by running this command:
155166
156167``` dart 
157- dart dev/tools/localization /gen_localizations.dart packages/flutter_localizations/lib/src/l10n material 
168+ dart dev/tools/localizations /gen_localizations.dart packages/flutter_localizations/lib/src/l10n material 
158169``` 
159170
160171The gen_localizations app just combines the contents of all of the
161- .arb files into a single ` Map `  that has entries for each .arb
162- file's locale. The ` MaterialLocalizations `  class implementation uses
163- this Map to implement the methods that lookup localized resource
164- values.
172+ .arb files into a single ` Map `  per library that has entries for each .arb
173+ file's locale. The ` MaterialLocalizations `  and ` CupertinoLocalizations ` 
174+ class implementations use these Maps to implement the methods that lookup localized resource values.
165175
166176The gen_localizations app must be run by hand after .arb files have
167177been updated. The app's first parameter is the path to this directory,
168178the second is the file name prefix (the file name less the locale
169179suffix) for the .arb files in this directory.
170180
171- To in-place update the ` localizations.dart  `  file using the default
181+ To in-place update the generated  localizations file using the default
172182values, you can just run:
173183
174184``` dart 
175- dart dev/tools/localization /gen_localizations.dart --overwrite 
185+ dart dev/tools/localizations /gen_localizations.dart --overwrite 
176186``` 
177187
178188
179189### Translations Status, Reporting Errors  
180190
181191The translations (the ` .arb `  files) in this directory are based on the
182- English translations in ` material_en.arb ` . Google contributes 
183- translations for all the languages supported by this package. 
184- (Googlers, for more details see <go/flutter-l10n>.)
192+ English translations in ` material_en.arb `  and  ` cupertino_en.arb ` . 
193+ Google contributes  translations for all the languages supported by
194+ this package.  (Googlers, for more details see <go/flutter-l10n>.)
185195
186196If you have feedback about the translations please
187197[ file an issue on the Flutter github repo] ( https://github.com/flutter/flutter/issues/new?template=BUG.md ) .
0 commit comments