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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 141a3da0e4867789a6aa6170057bfad33d7bad09
4
- data.tar.gz: 270b6f237b47c64add31b924c0db5d0a73e363d8
3
+ metadata.gz: 986b39f475cd63d9f801d4973287cf232ede2e29
4
+ data.tar.gz: 22fbff7667ff6d7d8f2ccbf3fb5793c10f926528
5
5
  SHA512:
6
- metadata.gz: 3fa4d6f205c3ffd0531e6ab327a5fd05ea22da480ff91f3ee3e6e271d9ae6cc8100f0680a486de14e11ec220fb90d770bea3ff587e97e10c5a54879ba4ddc6a6
7
- data.tar.gz: 51dfe3730446c59f57a2139f39f6bdb6db6242153d55e914d648fd83ff17ace64c17d168ddba1b49fd1babf74fbc7b566e8197e7c0795c19271c7312f9dd5245
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 \"#{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 \"#{key_id}\"...")
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(filtered_projects),
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(projects)
59
- prompt.select('Choose a project: ', projects)
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
@@ -1,3 +1,3 @@
1
1
  module PolyglotCli
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
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.3
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-17 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler