i18n-cli 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/i18n-cli/i18n-cli.rb +17 -6
- data/lib/i18n-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: a6d850cf3e75dce7dc86f389d6a4c0ea8ba0fcf4da057f0035903ec574d0a2ea
|
4
|
+
data.tar.gz: ce4fdcd9549eaf4b2ada5c98f6d63c30c01ce1eb1fbd62041386bef120e0b4ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57d12668dd43f70aa55975a7c73f6350f171643ee66c7531327a1e5a2a429c5bc1f28a9fa373c97f05a33094cb658755566d2b2967e338e061c3ef739744aba8
|
7
|
+
data.tar.gz: b96b21134f227e2aa24ee70dfc447a65390ff4319e614148fc6fa86d90fc75fb572af856f7c8c6e44ae885b79c63b01b9e91a11c96723dbd23ba6123b7bb9111
|
data/lib/i18n-cli/i18n-cli.rb
CHANGED
@@ -60,31 +60,42 @@ module I18n
|
|
60
60
|
|
61
61
|
def commit
|
62
62
|
localization_hash = JSON.parse(File.open(LOCALIZATION_FILE, &:read))
|
63
|
+
localization_lock_hash = JSON.parse(File.open(LOCALIZATION_LOCK_FILE, &:read))
|
64
|
+
|
65
|
+
if localization_hash['version'] < localization_lock_hash['metadata']['version']
|
66
|
+
apply
|
67
|
+
return
|
68
|
+
end
|
69
|
+
|
63
70
|
keys_hash = localization_hash['strings']
|
64
71
|
localization_keys = keys_hash.keys
|
65
72
|
languages = keys_hash[localization_keys[0]].keys
|
66
73
|
|
67
74
|
data = Hash[languages.map{ |l| [l, Hash[localization_keys.map{ |k| [k, keys_hash[k][l]] }]] }]
|
68
75
|
|
69
|
-
|
70
|
-
version = old_localization_lock_hash['metadata']['version']
|
76
|
+
version = localization_hash['version']
|
71
77
|
version_split = version.split('.')
|
72
78
|
|
73
|
-
|
79
|
+
new_localization_lock_hash = {
|
74
80
|
data: data,
|
75
81
|
metadata: {
|
76
82
|
cliVersion: VERSION,
|
77
|
-
projectName:
|
83
|
+
projectName: localization_lock_hash['metadata']['projectName'],
|
78
84
|
version: "#{version_split[0]}.#{version_split[1].to_i + 1}"
|
79
85
|
}
|
80
86
|
}
|
81
87
|
|
82
|
-
file_content = JSON.pretty_generate(
|
88
|
+
file_content = JSON.pretty_generate(new_localization_lock_hash)
|
83
89
|
File.write(LOCALIZATION_LOCK_FILE, file_content)
|
84
90
|
end
|
85
91
|
|
86
92
|
def help
|
87
|
-
puts
|
93
|
+
puts %(
|
94
|
+
Commands:
|
95
|
+
- init \t [project-name] [language-1] [language-2] ... [language-n]
|
96
|
+
- apply \t Create localization.json file to edit localizations
|
97
|
+
- commit \t Update .localization.lock with the localization.json updates
|
98
|
+
)
|
88
99
|
end
|
89
100
|
end
|
90
101
|
|
data/lib/i18n-cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luciano Prestes Cavalcanti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|