* 🐛 Fix Spelling Issues in Main README.md * 🐛 Fix spelling issues in dev README.md * 🐛 Fix spelling issues in complex_layout README.md * 🐛 Fix spelling issues in macrobenchmarks README.md * 🐛 Fix spelling issues in platform_views_layout README.md * 🐛 Fix spelling issues in test_Apps/stocks README.md * 🐛 Fix spelling issues in bots README.md * ✒ Spell Check dev/ci README.md * ✒ Spell Check dev/ci/docker_linux README.md * ✒ Spell Check dev/devicelab README.md * ✒ Spell Check dev/docs README.md * ✒ Spell Check dev/snippets README.md * ✒ Spell Check dev/snippets/config/templates README.md * ✒ Spell Check dev/tools/gen_keycodes README.md * ✒ Spell Check dev/tools/vitool README.md * ✒ Spell Check examples/catalog README.md * ✒ Spell Check examples/flutter_view README.md * ✒ Spell Check examples/image_list README.md * ✒ Spell Check examples/layers README.md * ✒ Spell Check examples/platform_channel README.md * ✒ Spell Check examples/platform_channel_swift README.md * ✒ Spell Check examples/platform_view README.md * ✒ Spell Check packages/_flutter_web_build_script README.md * ✒ Spell Check packages/flutter_localizations README.md * ✒ Spell Check packages/flutter_tools README.md * ✒ Spell Check CODE_OF_CONDUCT.md * ✒ Spell Check dev/integration_test/android_splash_screens/splash_Screen_load_rotate README.md * ✒ Spell Check dev/integration_test/android_views README.md * ✒ Spell Check dev/integration_tests/flutter_driver_screenshot_test README.md * ✒ Spell Check dev/integration_tests/flutter_gallery README.md * ✒ Spell Check dev/integration_tests/gradle_deprecated_settings README.md * ✒ Spell Check dev/integration_tests/ios_add2app_life_cycle README.md * ✒ Spell Check dev/integration_tests/ios_host_app README.md * ✒ Spell Check dev/integration_tests/ios_platform_view_tests README.md * ✒ Spell Check dev/automated_tests/flutter_test README.md * ✒ Spell Check .github/PULL_REQUEST_TEMPLATE.md * ✒ Spell Check .hithub/ISSUE_TEMPLATE/ACTIVATION.md * ✒ Spell Check .github/ISSUE_TEMPLATE/BUG.md * ✒ Spell Check .github/ISSUE_TEMPLATE/feature_request.md * ✒ Spell Check .github/ISSUE_TEMPLATE/performance_others.md * ✒ Spell Check .github/ISSUE_TEMPLATE/performance_speed.md * ✒ Spell Check packages/flutter_tools/doc/daemon.md * ✒ Spell Check packages/flutter_tools/fuchsia_enrtypoint_shim/README.md * ✒ Minimize line to 80 columns * ✒ Minimize line to 80 columns * ✒ Fix Typo * ✒ Chnaged numbers to 1 for testing purposes * ✒ Changed numbers to 1 for testing purposes * ❌ Remove 'a' which is a typo * ✒ Change a sentence to be better * ✒ Remove 'a' which is a typo * ✒ Fix small issue * ✒ Fix small typo * ✒ Fix some typos * ❌ Remove trailing space * ❌ Remove trailing space * 🐛 Fix small typo * ✒ Fix Typo * 🐛 Fix small bug
3 KiB
Flutter Framework localizations
This package contains the localizations used by the Flutter framework itself.
See the localization README for more detailed information about the localizations themselves.
Adding a new string to localizations
If you (someone contributing to the Flutter framework) want to add a new
string to the MaterialLocalizations
, WidgetsLocalizations
or the
CupertinoLocalizations
objects (e.g. because you've added a new widget
and it has a tooltip), follow these steps (these instructions are for
MaterialLocalizations
, but apply equally to CupertinoLocalizations
and WidgetsLocalizations
, with appropriate name substitutions):
-
Add the new getter to the localizations class
MaterialLocalizations
, influtter_localizations/lib/src/material_localizations.dart
. -
Implement a default value in
DefaultMaterialLocalizations
influtter_localizations/lib/src/material_localizations.dart
-
Add a test to
test/material/localizations_test.dart
that verifies that this new value is implemented. -
Update the
flutter_localizations
package. To add a new string to theflutter_localizations
package, you must first add it to the English translations (lib/src/l10n/material_en.arb
), including a description.Then you need to add new entries for the string to all of the other language locale files by running:
dart dev/tools/localization/bin/gen_missing_localizations.dart
Which will copy the English strings into the other locales as placeholders until they can be translated.
Finally you need to re-generate lib/src/l10n/localizations.dart by running:
dart dev/tools/localization/bin/gen_localizations.dart --overwrite
There is a localization README file with further information in the
lib/src/l10n/
directory. -
If you are a Google employee, you should then also follow the instructions at
go/flutter-l10n
. If you're not, don't worry about it.
Updating an existing string
If you or someone contributing to the Flutter framework wants to modify an existing string in the MaterialLocalizations objects, follow these steps:
-
Modify the default value of the relevant getter(s) in
DefaultMaterialLocalizations
below. -
Update the
flutter_localizations
package. Modify the out-of-date English strings inlib/src/l10n/material_en.arb
.You also need to re-generate
lib/src/l10n/localizations.dart
by running:dart dev/tools/localization/bin/gen_localizations.dart --overwrite
This script may result in your updated getters being created in newer locales and set to the old value of the strings. This is to be expected. Leave them as they were generated, and they will be picked up for translation.
There is a localization README file with further information in the
lib/src/l10n/
directory. -
If you are a Google employee, you should then also follow the instructions at
go/flutter-l10n
. If you're not, don't worry about it.