tree: ab31edb84fc8081a2cbec902141df4816c62d09c [path history] [tgz]
  1. cupertino_af.arb
  2. cupertino_am.arb
  3. cupertino_ar.arb
  4. cupertino_as.arb
  5. cupertino_az.arb
  6. cupertino_be.arb
  7. cupertino_bg.arb
  8. cupertino_bn.arb
  9. cupertino_bs.arb
  10. cupertino_ca.arb
  11. cupertino_cs.arb
  12. cupertino_da.arb
  13. cupertino_de.arb
  14. cupertino_de_CH.arb
  15. cupertino_el.arb
  16. cupertino_en.arb
  17. cupertino_en_AU.arb
  18. cupertino_en_CA.arb
  19. cupertino_en_GB.arb
  20. cupertino_en_IE.arb
  21. cupertino_en_IN.arb
  22. cupertino_en_NZ.arb
  23. cupertino_en_SG.arb
  24. cupertino_en_ZA.arb
  25. cupertino_es.arb
  26. cupertino_es_419.arb
  27. cupertino_es_AR.arb
  28. cupertino_es_BO.arb
  29. cupertino_es_CL.arb
  30. cupertino_es_CO.arb
  31. cupertino_es_CR.arb
  32. cupertino_es_DO.arb
  33. cupertino_es_EC.arb
  34. cupertino_es_GT.arb
  35. cupertino_es_HN.arb
  36. cupertino_es_MX.arb
  37. cupertino_es_NI.arb
  38. cupertino_es_PA.arb
  39. cupertino_es_PE.arb
  40. cupertino_es_PR.arb
  41. cupertino_es_PY.arb
  42. cupertino_es_SV.arb
  43. cupertino_es_US.arb
  44. cupertino_es_UY.arb
  45. cupertino_es_VE.arb
  46. cupertino_et.arb
  47. cupertino_eu.arb
  48. cupertino_fa.arb
  49. cupertino_fi.arb
  50. cupertino_fil.arb
  51. cupertino_fr.arb
  52. cupertino_fr_CA.arb
  53. cupertino_gl.arb
  54. cupertino_gsw.arb
  55. cupertino_gu.arb
  56. cupertino_he.arb
  57. cupertino_hi.arb
  58. cupertino_hr.arb
  59. cupertino_hu.arb
  60. cupertino_hy.arb
  61. cupertino_id.arb
  62. cupertino_is.arb
  63. cupertino_it.arb
  64. cupertino_ja.arb
  65. cupertino_ka.arb
  66. cupertino_kk.arb
  67. cupertino_km.arb
  68. cupertino_kn.arb
  69. cupertino_ko.arb
  70. cupertino_ky.arb
  71. cupertino_lo.arb
  72. cupertino_lt.arb
  73. cupertino_lv.arb
  74. cupertino_mk.arb
  75. cupertino_ml.arb
  76. cupertino_mn.arb
  77. cupertino_mr.arb
  78. cupertino_ms.arb
  79. cupertino_my.arb
  80. cupertino_nb.arb
  81. cupertino_ne.arb
  82. cupertino_nl.arb
  83. cupertino_no.arb
  84. cupertino_or.arb
  85. cupertino_pa.arb
  86. cupertino_pl.arb
  87. cupertino_pt.arb
  88. cupertino_pt_PT.arb
  89. cupertino_ro.arb
  90. cupertino_ru.arb
  91. cupertino_si.arb
  92. cupertino_sk.arb
  93. cupertino_sl.arb
  94. cupertino_sq.arb
  95. cupertino_sr.arb
  96. cupertino_sr_Latn.arb
  97. cupertino_sv.arb
  98. cupertino_sw.arb
  99. cupertino_ta.arb
  100. cupertino_te.arb
  101. cupertino_th.arb
  102. cupertino_tl.arb
  103. cupertino_tr.arb
  104. cupertino_uk.arb
  105. cupertino_ur.arb
  106. cupertino_uz.arb
  107. cupertino_vi.arb
  108. cupertino_zh.arb
  109. cupertino_zh_HK.arb
  110. cupertino_zh_TW.arb
  111. cupertino_zu.arb
  112. generated_cupertino_localizations.dart
  113. generated_date_localizations.dart
  114. generated_material_localizations.dart
  115. material_af.arb
  116. material_am.arb
  117. material_ar.arb
  118. material_as.arb
  119. material_az.arb
  120. material_be.arb
  121. material_bg.arb
  122. material_bn.arb
  123. material_bs.arb
  124. material_ca.arb
  125. material_cs.arb
  126. material_da.arb
  127. material_de.arb
  128. material_de_CH.arb
  129. material_el.arb
  130. material_en.arb
  131. material_en_AU.arb
  132. material_en_CA.arb
  133. material_en_GB.arb
  134. material_en_IE.arb
  135. material_en_IN.arb
  136. material_en_NZ.arb
  137. material_en_SG.arb
  138. material_en_ZA.arb
  139. material_es.arb
  140. material_es_419.arb
  141. material_es_AR.arb
  142. material_es_BO.arb
  143. material_es_CL.arb
  144. material_es_CO.arb
  145. material_es_CR.arb
  146. material_es_DO.arb
  147. material_es_EC.arb
  148. material_es_GT.arb
  149. material_es_HN.arb
  150. material_es_MX.arb
  151. material_es_NI.arb
  152. material_es_PA.arb
  153. material_es_PE.arb
  154. material_es_PR.arb
  155. material_es_PY.arb
  156. material_es_SV.arb
  157. material_es_US.arb
  158. material_es_UY.arb
  159. material_es_VE.arb
  160. material_et.arb
  161. material_eu.arb
  162. material_fa.arb
  163. material_fi.arb
  164. material_fil.arb
  165. material_fr.arb
  166. material_fr_CA.arb
  167. material_gl.arb
  168. material_gsw.arb
  169. material_gu.arb
  170. material_he.arb
  171. material_hi.arb
  172. material_hr.arb
  173. material_hu.arb
  174. material_hy.arb
  175. material_id.arb
  176. material_is.arb
  177. material_it.arb
  178. material_ja.arb
  179. material_ka.arb
  180. material_kk.arb
  181. material_km.arb
  182. material_kn.arb
  183. material_ko.arb
  184. material_ky.arb
  185. material_lo.arb
  186. material_lt.arb
  187. material_lv.arb
  188. material_mk.arb
  189. material_ml.arb
  190. material_mn.arb
  191. material_mr.arb
  192. material_ms.arb
  193. material_my.arb
  194. material_nb.arb
  195. material_ne.arb
  196. material_nl.arb
  197. material_no.arb
  198. material_or.arb
  199. material_pa.arb
  200. material_pl.arb
  201. material_ps.arb
  202. material_pt.arb
  203. material_pt_PT.arb
  204. material_ro.arb
  205. material_ru.arb
  206. material_si.arb
  207. material_sk.arb
  208. material_sl.arb
  209. material_sq.arb
  210. material_sr.arb
  211. material_sr_Latn.arb
  212. material_sv.arb
  213. material_sw.arb
  214. material_ta.arb
  215. material_te.arb
  216. material_th.arb
  217. material_tl.arb
  218. material_tr.arb
  219. material_uk.arb
  220. material_ur.arb
  221. material_uz.arb
  222. material_vi.arb
  223. material_zh.arb
  224. material_zh_HK.arb
  225. material_zh_TW.arb
  226. material_zu.arb
  227. README.md
packages/flutter_localizations/lib/src/l10n/README.md

Material and Cupertino Libraries Localizations

The .arb files in this directory contain localized values (primarily strings) used by the Material and Cupertino libraries. The generated_material_localizations.dart and generated_cupertino_localizations.dart files combine all of the localizations into a single Map that is linked with the rest of flutter_localizations package.

If you're looking for information about internationalizing Flutter apps in general, see the Internationalizing Flutter Apps tutorial.

Translations for one locale: .arb files

The Material and Cupertino libraries use Application Resource Bundle files, which have a .arb extension, to store localized translations of messages, format strings, and other values. This format is also used by the Dart intl package and it is supported by the Google Translators Toolkit.

The Material and Cupertino libraries only depend on a small subset of the ARB format. Each .arb file contains a single JSON table that maps from resource IDs to localized values.

Filenames contain the locale that the values have been translated for. For example material_de.arb contains German translations, and material_ar.arb contains Arabic translations. Files that contain regional translations have names that include the locale's regional suffix. For example material_en_GB.arb contains additional English translations that are specific to Great Britain.

There is one language-specific .arb file for each supported locale. If an additional file with a regional suffix is present, the regional localizations are automatically merged with the language-specific ones.

The JSON table's keys, called resource IDs, are valid Dart variable names. They correspond to methods from the MaterialLocalizations or CupertinoLocalizations classes. For example:

Widget build(BuildContext context) {
  return TextButton(
    child: Text(
      MaterialLocalizations.of(context).cancelButtonLabel,
    ),
  );
}

This widget build method creates a button whose label is the local translation of “CANCEL” which is defined for the cancelButtonLabel resource ID.

Each of the language-specific .arb files contains an entry for cancelButtonLabel.

material_en.arb and cupertino_en.arb Define all of the resource IDs

All of the material_*.arb files whose names do not include a regional suffix contain translations for the same set of resource IDs as material_en.arb.

Similarly all of the cupertino_*.arb files whose names do not include a regional suffix contain translations for the same set of resource IDs as cupertino_en.arb.

For each resource ID defined for English, there is an additional resource with an ‘@’ prefix. These ‘@’ resources are not used by the generated Dart code at run time, they just exist to inform translators about how the value will be used, and to inform the code generator about what code to write.

"cancelButtonLabel": "CANCEL",
"@cancelButtonLabel": {
  "description": "The label for cancel buttons and menu items.",
  "type": "text"
},

Values with Parameters, Plurals

A few of material translations contain $variable tokens. The Material and Cupertino libraries replace these tokens with values at run-time. For example:

"aboutListTileTitle": "About $applicationName",

The value for this resource ID is retrieved with a parameterized method instead of a simple getter:

MaterialLocalizations.of(context).aboutListTileTitle(yourAppTitle)

The names of the $variable tokens must match the names of the MaterialLocalizations method parameters.

Plurals are handled similarly, with a lookup method that includes a quantity parameter. For example selectedRowCountTitle returns a string like “1 item selected” or “no items selected”.

MaterialLocalizations.of(context).selectedRowCountTitle(yourRowCount)

Plural translations can be provided for several quantities: 0, 1, 2, “few”, “many”, “other”. The variations are identified by a resource ID suffix which must be one of “Zero”, “One”, “Two”, “Few”, “Many”, “Other”. The “Other” variation is used when none of the other quantities apply. All plural resources must include a resource with the “Other” suffix. For example the English translations (‘material_en.arb’) for selectedRowCountTitle are:

"selectedRowCountTitleZero": "No items selected",
"selectedRowCountTitleOne": "1 item selected",
"selectedRowCountTitleOther": "$selectedRowCount items selected",

When defining new resources that handle pluralizations, the “One” and the “Other” forms must, at minimum, always be defined in the source English ARB files.

scriptCategory and timeOfDayFormat for Material library

In material_en.arb, the values of these resource IDs are not translations, they‘re keywords that help define an app’s text theme and time picker layout respectively.

The value of timeOfDayFormat defines how a time picker displayed by showTimePicker() formats and lays out its time controls. The value of timeOfDayFormat must be a string that matches one of the formats defined by https://api.flutter.dev/flutter/material/TimeOfDayFormat.html. It is converted to an enum value because the material_en.arb file has this value labeled as "x-flutter-type": "icuShortTimePattern".

The value of scriptCategory is based on the Language categories reference section in the Material spec. The Material theme uses the scriptCategory value to lookup a localized version of the default TextTheme, see Typography.geometryThemeFor.

‘generated_*_localizations.dart’: all of the localizations

All of the localizations are combined in a single file per library using the gen_localizations script.

You can see what that script would generate by running:

dart dev/tools/localization/bin/gen_localizations.dart

Actually update the generated files with:

dart dev/tools/localization/bin/gen_localizations.dart --overwrite

The gen_localizations script just combines the contents of all of the .arb files, each into a class which extends Global*Localizations. The MaterialLocalizations and CupertinoLocalizations class implementations use these to lookup localized resource values.

The gen_localizations script must be run by hand after .arb files have been updated. The script optionally takes parameters

  1. The path to this directory,
  2. The file name prefix (the file name less the locale suffix) for the .arb files in this directory.

Special handling for the Kannada (kn) translations

Originally, the cupertino_kn.arb and material_kn.arb files contained unicode characters that can cause current versions of Emacs on Linux to crash. There is more information here: https://github.com/flutter/flutter/issues/36704.

Rather than risking developers' editor sessions, the strings in these arb files (and the code generated for them) have been encoded using the appropriate escapes for JSON and Dart. The JSON format arb files were rewritten with dev/tools/localization/bin/encode_kn_arb_files.dart. The localizations code generator uses generateEncodedString() from dev/tools/localization/localizations_utils.dart.

Support for Pashto (ps) translations

When Flutter first set up i18n for the Material library, Pashto (ps) translations were included for the first set of Material widgets. However, Pashto was never set up to be continuously maintained in Flutter by Google, so material_ps.arb was never updated beyond the initial commit.

To prevent breaking applications that rely on these original Pashto translations, they will be kept. However, all new strings will have the English translation until support for Pashto is provided. See https://github.com/flutter/flutter/issues/60598.

Translations Status, Reporting Errors

The translations (the .arb files) in this directory are based on the English translations in material_en.arb and cupertino_en.arb. Google contributes translations for all the languages supported by this package. (Googlers, for more details see <go/flutter-l10n>.)

If you have feedback about the translations please file an issue on the Flutter github repo.

See Also

The Internationalizing Flutter Apps tutorial describes how to use the internationalization APIs in an ordinary Flutter app.

Application Resource Bundle covers the .arb file format used to store localized translations of messages, format strings, and other values.

The Dart intl package supports internationalization.