From b4788f290ce0f541ab3381c2fbc4443079302520 Mon Sep 17 00:00:00 2001 From: Darren Austin Date: Thu, 14 May 2020 11:12:05 -0700 Subject: [PATCH] Updated gen_missing_localizations to copy the english strings instead of using 'TBD' for other locales. (#57053) --- dev/tools/localization/bin/gen_missing_localizations.dart | 6 ++++-- .../flutter/lib/src/material/material_localizations.dart | 8 +++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dev/tools/localization/bin/gen_missing_localizations.dart b/dev/tools/localization/bin/gen_missing_localizations.dart index ddd8a5e255..9dffe582b8 100644 --- a/dev/tools/localization/bin/gen_missing_localizations.dart +++ b/dev/tools/localization/bin/gen_missing_localizations.dart @@ -77,7 +77,8 @@ void updateMissingResources(String localizationPath, String groupPrefix) { final Directory localizationDir = Directory(localizationPath); final RegExp filenamePattern = RegExp('${groupPrefix}_(\\w+)\\.arb'); - final Set requiredKeys = resourceKeys(loadBundle(File(path.join(localizationPath, '${groupPrefix}_en.arb')))); + final Map englishBundle = loadBundle(File(path.join(localizationPath, '${groupPrefix}_en.arb'))); + final Set requiredKeys = resourceKeys(englishBundle); for (final FileSystemEntity entity in localizationDir.listSync().toList()..sort(sortFilesByPath)) { final String entityPath = entity.path; @@ -94,7 +95,8 @@ void updateMissingResources(String localizationPath, String groupPrefix) { (String key) => !isPluralVariation(key, localeBundle) && !intentionallyOmitted(key, localeBundle) ).toSet(); if (missingResources.isNotEmpty) { - localeBundle.addEntries(missingResources.map((String k) => MapEntry(k, 'TBD'))); + localeBundle.addEntries(missingResources.map((String k) => + MapEntry(k, englishBundle[k].toString()))); writeBundle(arbFile, localeBundle); print('Updated $entityPath with missing entries for $missingResources'); } diff --git a/packages/flutter/lib/src/material/material_localizations.dart b/packages/flutter/lib/src/material/material_localizations.dart index d0f8222589..be8ca9d5b5 100644 --- a/packages/flutter/lib/src/material/material_localizations.dart +++ b/packages/flutter/lib/src/material/material_localizations.dart @@ -29,11 +29,13 @@ import 'typography.dart'; // flutter_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 `TBD` entries for the string to all of the other +// 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: // ``` @@ -45,10 +47,6 @@ import 'typography.dart'; // // 5. 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. -// -// 6. If you're adding a String for the sake of Flutter, not for an app-specific -// version of this interface, you are making a breaking API change. See -// https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes. /// Defines the localized resource values used by the Material widgets. ///