mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Update translation descriptions: alertDialogLabel, searchFieldLabel (#19234)
This commit is contained in:
parent
cc122f1672
commit
fbf9044867
@ -8,6 +8,7 @@ import 'dart:io';
|
|||||||
/// Sanity checking of the @foo metadata in the English translations,
|
/// Sanity checking of the @foo metadata in the English translations,
|
||||||
/// material_en.arb.
|
/// material_en.arb.
|
||||||
///
|
///
|
||||||
|
/// - For each foo, resource, there must be a corresponding @foo.
|
||||||
/// - For each @foo resource, there must be a corresponding foo, except
|
/// - For each @foo resource, there must be a corresponding foo, except
|
||||||
/// for plurals, for which there must be a fooOther.
|
/// for plurals, for which there must be a fooOther.
|
||||||
/// - Each @foo resource must have a Map value with a String valued
|
/// - Each @foo resource must have a Map value with a String valued
|
||||||
@ -23,6 +24,24 @@ String validateEnglishLocalizations(File file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Map<String, dynamic> bundle = json.decode(file.readAsStringSync());
|
final Map<String, dynamic> bundle = json.decode(file.readAsStringSync());
|
||||||
|
|
||||||
|
for (String resourceId in bundle.keys) {
|
||||||
|
if (resourceId.startsWith('@'))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (bundle['@$resourceId'] != null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bool checkPluralResource(String suffix) {
|
||||||
|
final int suffixIndex = resourceId.indexOf(suffix);
|
||||||
|
return suffixIndex != -1 && bundle['@${resourceId.substring(0, suffixIndex)}'] != null;
|
||||||
|
}
|
||||||
|
if (<String>['Zero', 'One', 'Two', 'Few', 'Many', 'Other'].any(checkPluralResource))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
errorMessages.writeln('A value was not specified for @$resourceId');
|
||||||
|
}
|
||||||
|
|
||||||
for (String atResourceId in bundle.keys) {
|
for (String atResourceId in bundle.keys) {
|
||||||
if (!atResourceId.startsWith('@'))
|
if (!atResourceId.startsWith('@'))
|
||||||
continue;
|
continue;
|
||||||
|
@ -197,12 +197,12 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"alertDialogLabel": "Alert",
|
"alertDialogLabel": "Alert",
|
||||||
"@dialogLabel": {
|
"@alertDialogLabel": {
|
||||||
"description": "The audio announcement made when an AlertDialog is opened."
|
"description": "The audio announcement made when an AlertDialog is opened."
|
||||||
},
|
},
|
||||||
|
|
||||||
"searchFieldLabel": "Search",
|
"searchFieldLabel": "Search",
|
||||||
"@dialogLabel": {
|
"@searchFieldLabel": {
|
||||||
"description": "Label indicating that a text field is a search field. This will be used as a hint text in the text field."
|
"description": "Label indicating that a text field is a search field. This will be used as a hint text in the text field."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user