polyglot_cli 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/polyglot_cli/commands/push.rb +4 -4
- data/lib/polyglot_cli/commands/setup.rb +4 -4
- data/lib/polyglot_cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 986b39f475cd63d9f801d4973287cf232ede2e29
|
4
|
+
data.tar.gz: 22fbff7667ff6d7d8f2ccbf3fb5793c10f926528
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b264d809b955779fbf69c3fc0a5b9e326749c6b8e545699b2d2b6359ec998809cec568481a5485d6fde6b526bee67d25986bd8c618420f38e637bc3e070274a9
|
7
|
+
data.tar.gz: ab938488a64bdd00cd43ff5e3b66d691a43c4cb8eb23998b62031e3d3a282116a0263e844cb0b2021c0c2efd7260204aedc3907570dc6cab332665b3c5f7a5f7
|
data/README.md
CHANGED
@@ -32,9 +32,9 @@ This will prompt you for your email and password. If the the login attempt is su
|
|
32
32
|
|
33
33
|
Next you have to initialize the project and go through a quick setup:
|
34
34
|
|
35
|
-
polyglot init
|
35
|
+
polyglot init [--query]
|
36
36
|
|
37
|
-
This will prompt you to choose from a list of projects, and set your locale directory. The default locale directory is `config/locales` for rails apps.
|
37
|
+
This will prompt you to choose from a list of projects, and you can use the `--query` option to filter the list of projects. Also it will ask you to set your locale directory. The default locale directory is `config/locales` for rails apps. Finally, it will ask you whether you would like to use full locales or short locales. If you choose to include full locales, your files will be stored like this for example: `en_US` and `en_GB`. If you choose to exclude full locales, your files will then look like `en` for example, but you will be prompted to choose between `en_US` and `en_GB`, if a language has more than one locale.
|
38
38
|
|
39
39
|
## Usage
|
40
40
|
Once you have setup the project you can use any of the following commands:
|
@@ -45,19 +45,19 @@ module PolyglotCli
|
|
45
45
|
key_id = translation_keys[key]
|
46
46
|
|
47
47
|
if key_id.nil?
|
48
|
-
prompt.ok("Creating translation key
|
48
|
+
prompt.ok("Creating translation key: #{key}...")
|
49
49
|
key_id = create_translation_key(key)
|
50
50
|
end
|
51
51
|
|
52
|
-
create_translation(value, key_id, language_id)
|
52
|
+
create_translation(value, key, key_id, language_id)
|
53
53
|
end
|
54
54
|
|
55
55
|
def create_translation_key(name)
|
56
56
|
PolyglotCli::Resource::TranslationKey.token(token).create(name: name, project_id: project_id).id
|
57
57
|
end
|
58
58
|
|
59
|
-
def create_translation(value, key_id, language_id)
|
60
|
-
prompt.ok("Creating translation for key
|
59
|
+
def create_translation(value, key_name, key_id, language_id)
|
60
|
+
prompt.ok("Creating translation for key: #{key_name}...")
|
61
61
|
PolyglotCli::Resource::Translation.token(token).create(
|
62
62
|
value: value,
|
63
63
|
translation_key_id: key_id,
|
@@ -17,7 +17,7 @@ module PolyglotCli
|
|
17
17
|
|
18
18
|
def call
|
19
19
|
@config = {
|
20
|
-
project_id: project_id_prompt
|
20
|
+
project_id: project_id_prompt,
|
21
21
|
locale_path: locale_path_prompt
|
22
22
|
}
|
23
23
|
PolyglotCli::IO::Config.write(@config.merge(locale_mapping: locale_mapping))
|
@@ -55,8 +55,8 @@ module PolyglotCli
|
|
55
55
|
prompt.select("Choose a locale for #{language}: ", locales)
|
56
56
|
end
|
57
57
|
|
58
|
-
def project_id_prompt
|
59
|
-
prompt.select('Choose a project: ',
|
58
|
+
def project_id_prompt
|
59
|
+
prompt.select('Choose a project: ', filtered_projects)
|
60
60
|
end
|
61
61
|
|
62
62
|
def locale_path_prompt
|
@@ -71,7 +71,7 @@ module PolyglotCli
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def filtered_projects
|
74
|
-
projects.select { |key, _id| key[/^(.*?(#{option_query})[^$]*)$/i] }
|
74
|
+
projects.select { |key, _id| key[/^(.*?(#{option_query})[^$]*)$/i] }.sort_by { |p| p[0].downcase }.to_h
|
75
75
|
end
|
76
76
|
|
77
77
|
def option_query
|
data/lib/polyglot_cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyglot_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Grgurevic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|