flutter_polyglot_cli 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/flutter_polyglot_cli/helpers/general.rb +11 -0
- data/lib/flutter_polyglot_cli/serializers/localizations/localization_delegate_serializer.rb +4 -0
- data/lib/flutter_polyglot_cli/serializers/localizations/localization_keys_serializer.rb +1 -2
- data/lib/flutter_polyglot_cli/serializers/localizations/localization_serializer.rb +2 -0
- data/lib/flutter_polyglot_cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe67c3d215e3779b58be999c98160fd773e6cbdf096f64ba527b748cf00583cb
|
4
|
+
data.tar.gz: 4228ba3ec5274785a205e5f2001a03a6096791bb4de21a1fd27db6aecef3044d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7340d7ce57278b8fe76c894262ec7cacca2e684d6d1ced5909ef294129b7b2be7ce864b5a1580405ba4ac77f467aee811deafcf08c3b76129171a0c7ce329033
|
7
|
+
data.tar.gz: 04f45e84f4ec7c28900475937a9b7b20ffffebddb91fa83bd9de6223a92ad3546a549aac0635426402bab1189ff8a6d721d888dfa0a7b9d22fe445f39b12c615
|
data/Gemfile.lock
CHANGED
@@ -117,6 +117,17 @@ module PolyglotFlutter
|
|
117
117
|
strings[key_name] = translation_key.clean_translation(language)
|
118
118
|
end
|
119
119
|
end
|
120
|
+
|
121
|
+
def generate_static_locales(languages)
|
122
|
+
result_string = ''
|
123
|
+
language_locales = languages.each.map { |value| value['locale'].split('_').first }
|
124
|
+
locale_names = language_locales.each.map { |value| clean_variable_name("locale_#{value}") }
|
125
|
+
|
126
|
+
locale_names.each_with_index { |locale, index| result_string += "static Locale get #{locale} => const Locale('#{language_locales[index]}', '');\n\t" }
|
127
|
+
|
128
|
+
locale_list = locale_names.each.map { |value| "AppLocales.#{value}" }.join(', ')
|
129
|
+
result_string += "\n\tstatic List<Locale> get values => <Locale>[#{locale_list}];"
|
130
|
+
end
|
120
131
|
end
|
121
132
|
end
|
122
133
|
end
|
@@ -34,6 +34,10 @@ class LocalizationDelegate extends LocalizationsDelegate<Localization> {
|
|
34
34
|
@override
|
35
35
|
bool shouldReload(LocalizationDelegate old) => false;
|
36
36
|
}
|
37
|
+
|
38
|
+
extension AppLocales on Locale {
|
39
|
+
<%= generate_static_locales(languages) %>
|
40
|
+
}
|
37
41
|
TEMPLATE
|
38
42
|
end
|
39
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flutter_polyglot_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maroje Marcelic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|