Unverified Commit b4788f29 authored by Darren Austin's avatar Darren Austin Committed by GitHub

Updated gen_missing_localizations to copy the english strings instead of using...

Updated gen_missing_localizations to copy the english strings instead of using 'TBD' for other locales. (#57053)
parent f6fb3aaa
......@@ -77,7 +77,8 @@ void updateMissingResources(String localizationPath, String groupPrefix) {
final Directory localizationDir = Directory(localizationPath);
final RegExp filenamePattern = RegExp('${groupPrefix}_(\\w+)\\.arb');
final Set<String> requiredKeys = resourceKeys(loadBundle(File(path.join(localizationPath, '${groupPrefix}_en.arb'))));
final Map<String, dynamic> englishBundle = loadBundle(File(path.join(localizationPath, '${groupPrefix}_en.arb')));
final Set<String> 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<String, String>(k, 'TBD')));
localeBundle.addEntries(missingResources.map((String k) =>
MapEntry<String, String>(k, englishBundle[k].toString())));
writeBundle(arbFile, localeBundle);
print('Updated $entityPath with missing entries for $missingResources');
}
......
......@@ -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.
///
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment