@@ -15,11 +15,46 @@ and it has a tooltip), follow these steps (these instructions are for
...
@@ -15,11 +15,46 @@ and it has a tooltip), follow these steps (these instructions are for
`MaterialLocalizations`, but apply equally to `CupertinoLocalizations`
`MaterialLocalizations`, but apply equally to `CupertinoLocalizations`
and `WidgetsLocalizations`, with appropriate name substitutions):
and `WidgetsLocalizations`, with appropriate name substitutions):
1. Add the new getter to the localizations class `MaterialLocalizations`,
1. ### For messages without parameters, add new getter
in `flutter_localizations/lib/src/material_localizations.dart`.
```
String get showMenuTooltip;
```
to the localizations class `MaterialLocalizations`,
in [`packages/flutter/lib/src/material/material_localizations.dart`](https://github.com/harperl-lgtm/flutter/blob/bottomSheetScrimFocus/packages/flutter/lib/src/material/material_localizations.dart);
### For messages with parameters, add new function
For messages with parameters, do also add the function to `GlobalMaterialLocalizations` in [`packages/flutter_localizations/lib/src/material_localizations.dart`](https://github.com/harperl-lgtm/flutter/blob/bottomSheetScrimFocus/packages/flutter_localizations/lib/src/material_localizations.dart), and add a raw getter as demonstrated below:
```
/// The raw version of [aboutListTileTitle], with `$applicationName` verbatim
3. Add a test to `test/material/localizations_test.dart` that verifies that
3. Add a test to `test/material/localizations_test.dart` that verifies that
this new value is implemented.
this new value is implemented.
...
@@ -28,6 +63,23 @@ and `WidgetsLocalizations`, with appropriate name substitutions):
...
@@ -28,6 +63,23 @@ and `WidgetsLocalizations`, with appropriate name substitutions):
`flutter_localizations` package, you must first add it to the English
`flutter_localizations` package, you must first add it to the English
translations (`lib/src/l10n/material_en.arb`), including a description.
translations (`lib/src/l10n/material_en.arb`), including a description.
### Messages without parameters:
```
"showMenuTooltip": "Show menu",
"@showMenuTooltip": {
"description": "The tooltip for the button that shows a popup menu."
},
```
### Messages with parameters:
```
"aboutListTileTitle": "About $applicationName",
"@aboutListTileTitle": {
"description": "The default title for the drawer item that shows an about page for the application. The value of $applicationName is the name of the application, like GMail or Chrome.",
"parameters": "applicationName"
},
```
Then you need to add new 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:
language locale files by running:
```
```
...
@@ -41,6 +93,13 @@ and `WidgetsLocalizations`, with appropriate name substitutions):
...
@@ -41,6 +93,13 @@ and `WidgetsLocalizations`, with appropriate name substitutions):