Skip to content

Commit 24921d4

Browse files
committed
docs: simplify translations docs
1 parent f7c62eb commit 24921d4

File tree

3 files changed

+17
-33
lines changed

3 files changed

+17
-33
lines changed

.github/.cspell/words_dictionary.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@ verygood # Very Good, but without a space.
3030
xcode # Apple's integrated development environment.
3131
xcworkspace # Abbreviation for Xcode workspace.
3232
xcassets # Abbreviation for Xcode assets.
33+
hola # part of translations example
34+
mundo # part of translations example
35+
saludo # part of translations example

very_good_core/__brick__/.github/cspell.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
"localizable",
2121
"mostrado",
2222
"página",
23-
"Texto"
23+
"Texto",
24+
"Hola",
25+
"Mundo",
26+
"Saludo"
2427
]
2528
}

very_good_core/__brick__/README.md

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,7 @@ This project follows the [official internationalization guide for Flutter][inter
7777

7878
### Adding Strings
7979

80-
1. To add a new localizable string, open the `app_en.arb` file at `lib/l10n/arb/app_en.arb`.
81-
82-
```arb
83-
{
84-
"@@locale": "en",
85-
"counterAppBarTitle": "Counter",
86-
"@counterAppBarTitle": {
87-
"description": "Text shown in the AppBar of the Counter Page"
88-
}
89-
}
90-
```
91-
92-
2. Then add a new key/value and description
80+
1. To add a new localizable string, open the `app_en.arb` file at `lib/l10n/arb/app_en.arb` and add a new key/value pair with the relevant description (optional):
9381

9482
```arb
9583
{
@@ -100,12 +88,12 @@ This project follows the [official internationalization guide for Flutter][inter
10088
},
10189
"helloWorld": "Hello World",
10290
"@helloWorld": {
103-
"description": "Hello World Text"
91+
"description": "Hello World greeting."
10492
}
10593
}
10694
```
10795

108-
3. Use the new string
96+
2. Use the new string:
10997

11098
```dart
11199
import 'package:{{project_name.snakeCase()}}/l10n/l10n.dart';
@@ -135,7 +123,7 @@ Update the `CFBundleLocalizations` array in the `Info.plist` at `ios/Runner/Info
135123

136124
### Adding Translations
137125

138-
1. For each supported locale, add a new ARB file in `lib/l10n/arb`.
126+
1. For each supported locale, add a new ARB file in `lib/l10n/arb`:
139127

140128
```
141129
├── l10n
@@ -144,19 +132,7 @@ Update the `CFBundleLocalizations` array in the `Info.plist` at `ios/Runner/Info
144132
│ │ └── app_es.arb
145133
```
146134

147-
2. Add the translated strings to each `.arb` file:
148-
149-
`app_en.arb`
150-
151-
```arb
152-
{
153-
"@@locale": "en",
154-
"counterAppBarTitle": "Counter",
155-
"@counterAppBarTitle": {
156-
"description": "Text shown in the AppBar of the Counter Page"
157-
}
158-
}
159-
```
135+
2. Add the translated strings to the new `.arb` file:
160136

161137
`app_es.arb`
162138

@@ -166,16 +142,18 @@ Update the `CFBundleLocalizations` array in the `Info.plist` at `ios/Runner/Info
166142
"counterAppBarTitle": "Contador",
167143
"@counterAppBarTitle": {
168144
"description": "Texto mostrado en la AppBar de la página del contador"
169-
}
145+
},
146+
"helloWorld": "Hola Mundo",
147+
"@helloWorld": {
148+
"description": "Saludo Hola Mundo."
149+
}
170150
}
171151
```
172152

173153
### Generating Translations
174154

175155
To use the latest translations changes, you will need to generate them:
176156

177-
1. Generate localizations for the current project:
178-
179157
```sh
180158
flutter gen-l10n --arb-dir="lib/l10n/arb"
181159
```

0 commit comments

Comments
 (0)