Skip to content

Commit cdda813

Browse files
committed
Merge branch 'master' into upgrade-dependencies
# Conflicts: # flutter_sheet_localization_generator/pubspec.yaml
2 parents 776a517 + 8106cb2 commit cdda813

File tree

16 files changed

+199
-162
lines changed

16 files changed

+199
-162
lines changed

README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ Add the following to your `pubspec.yaml`:
88

99
```sh
1010
dependencies:
11-
flutter_sheet_localization: ^2.0.0
11+
flutter_sheet_localization: <latest>
12+
intl: <latest>
1213

1314
dev_dependencies:
14-
flutter_sheet_localization_generator: ^2.0.0
15-
build_runner: ^1.3.1
15+
flutter_sheet_localization_generator: <latest>
16+
build_runner: ^1.10.2
1617
```
1718

1819
### Usage
@@ -115,6 +116,16 @@ The file should have :
115116
* Column 0 : the label key (can be a hierarchy, separated by dots)
116117
* then each translation based on language code of the column
117118

119+
### Ignoring a column
120+
121+
Sometimes you may need to add comments for translators. For this, simply add a column with a name between parenthesis and the column will be completely ignored by the generator.
122+
123+
Example :
124+
125+
> | Key | (Comments) | fr | en |
126+
> | --- | --- | --- | --- |
127+
> | example.man(Gender.male) | This is a man title on home page | homme | man |
128+
> | example.man(Gender.female) | This is a woman title on home page | femme | woman |
118129
119130
### Conditionals
120131

@@ -144,13 +155,15 @@ Example :
144155
> | example.man(Plural.one) | homme | man |
145156
> | example.man(Plural.multiple) | hommes | men |
146157
147-
From your Dart code, you can then define a function :
158+
From your Dart code, you can then define an extension :
148159

149160
```dart
150-
Plural plural(int count) {
151-
if (count == 0) return Plural.zero;
152-
if (count == 1) return Plural.one;
153-
return Plural.multiple;
161+
extension PluralExtension on int {
162+
Plural plural() {
163+
if (this == 0) return Plural.zero;
164+
if (this == 1) return Plural.one;
165+
return Plural.multiple;
166+
}
154167
}
155168
```
156169

flutter_sheet_localization/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.1
2+
3+
- Removed pedantic dependency.
4+
15
## 2.0.0
26

37
- Added version to force regeneration.

flutter_sheet_localization/analysis_options.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import 'package:flutter_sheet_localization/flutter_sheet_localization.dart';
22

3-
@SheetLocalization("", "", 1)
3+
@SheetLocalization('', '', 1)
44
class AppLabels {}
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
name: flutter_sheet_localization
22
description: Annotations for the flutter_sheet_localization_generator package.
3-
version: 2.0.0
3+
version: 2.0.1
44
homepage: https://github.com/aloisdeniel/flutter_sheet_localization
55

66
environment:
7-
sdk: '>=2.5.0 <3.0.0'
8-
9-
dev_dependencies:
10-
pedantic: ^1.8.0
7+
sdk: '>=2.7.0 <3.0.0'
0 Bytes
Binary file not shown.

flutter_sheet_localization_generator/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## 2.1.2
2+
3+
- Upgraded dependencies.
4+
5+
## 2.1.1
6+
7+
- Ignoring `camel_case_types` linter rule.
8+
- Updated typedef format.
9+
10+
## 2.1.0
11+
12+
- Added ignored columns when named `(<name>)`.
13+
- Strings are now generated with `'` instead of `"`.
14+
115
## 2.0.2
216

317
- Upgraded recase dependency.

flutter_sheet_localization_generator/README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ Add the following to your `pubspec.yaml`:
88

99
```sh
1010
dependencies:
11-
flutter_sheet_localization: ^1.0.0
11+
flutter_sheet_localization: <latest>
12+
intl: <latest>
1213

1314
dev_dependencies:
14-
flutter_sheet_localization_generator: ^1.0.0
15-
build_runner: ^1.3.1
15+
flutter_sheet_localization_generator: <latest>
16+
build_runner: ^1.10.2
1617
```
1718

1819
### Usage
@@ -115,6 +116,16 @@ The file should have :
115116
* Column 0 : the label key (can be a hierarchy, separated by dots)
116117
* then each translation based on language code of the column
117118

119+
### Ignoring a column
120+
121+
Sometimes you may need to add comments for translators. For this, simply add a column with a name between parenthesis and the column will be completely ignored by the generator.
122+
123+
Example :
124+
125+
> | Key | (Comments) | fr | en |
126+
> | --- | --- | --- | --- |
127+
> | example.man(Gender.male) | This is a man title on home page | homme | man |
128+
> | example.man(Gender.female) | This is a woman title on home page | femme | woman |
118129
119130
### Conditionals
120131

@@ -144,13 +155,15 @@ Example :
144155
> | example.man(Plural.one) | homme | man |
145156
> | example.man(Plural.multiple) | hommes | men |
146157
147-
From your Dart code, you can then define a function :
158+
From your Dart code, you can then define an extension :
148159

149160
```dart
150-
Plural plural(int count) {
151-
if (count == 0) return Plural.zero;
152-
if (count == 1) return Plural.one;
153-
return Plural.multiple;
161+
extension PluralExtension on int {
162+
Plural plural() {
163+
if (this == 0) return Plural.zero;
164+
if (this == 1) return Plural.one;
165+
return Plural.multiple;
166+
}
154167
}
155168
```
156169

flutter_sheet_localization_generator/example/lib/localizations.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import 'package:intl/intl.dart';
55

66
part 'localizations.g.dart';
77

8-
Plural plural(int count) {
9-
if (count == 0) return Plural.zero;
10-
if (count == 1) return Plural.one;
11-
return Plural.multiple;
8+
extension PluralExtension on int {
9+
Plural plural() {
10+
if (this == 0) return Plural.zero;
11+
if (this == 1) return Plural.one;
12+
return Plural.multiple;
13+
}
1214
}
1315

1416
@SheetLocalization('1AcjI1BjmQpjlnPUZ7aVLbrnVR98xtATnSjU4CExM9fs', '0', 15)

0 commit comments

Comments
 (0)