smartling_rails 0.0.1 → 0.0.2

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: af36d0e14d0cfd1842e31029fb8201199fa9a98b
4
- data.tar.gz: 9e1d5075c788d9610e995bd178e3e14cbe86e348
3
+ metadata.gz: 717f0ee405949bddbb8480a1f11e4635ea9016f1
4
+ data.tar.gz: 26880aa15a108be5ff5e8b1566381dbe3dec347b
5
5
  SHA512:
6
- metadata.gz: 389002303e955692bc9fc3da24a0ae4968437b7e304d88e8187c4720aa0895102d9bfa316752ba94e906095f2620ac3884b4ddd86494724eea83b1ac1013fcb2
7
- data.tar.gz: 17e9c0e2f971d6dbea39013b5fecd995837445502346b5c985d9b73f9929eff332b9c0dcba3786348ee2441c3bfb1af220c37b54fb06abd84924b2e466a591a3
6
+ metadata.gz: 1ce9a145ad5362b3ac8044f14c4dc1997da09f173245b8efb6775f7470598cdae750e42c5955b8ee460cf0b85a12ae7cc9766de51f6fe15a9f67c062dac9fef1
7
+ data.tar.gz: 5e36c29103304b94e5406cd47b4bc73b5bed4fff61386e86582618bd1975a8998f5cb2df1abac3e32685b4fd2e2931a1cffc165655cf6330b181072aa711ddd9
data/README.md CHANGED
@@ -1,2 +1,95 @@
1
- # smartling-rails
2
- Gem for uploading, checking and getting information from smartling into a rails app using I18N
1
+ # Welcome to Smartling Rails
2
+ SmartlingRails is a gem making localization with the [smartling](www.smartling.com) localization service easier in a ruby on rails environment. The Gem simplifies the uploading, status checking, and retrieval of information from smartling into a rails app that uses I18N localization.
3
+
4
+ Communication with smartling is done via their APIs and leverages the [smartling gem](https://rubygems.org/gems/smartling).
5
+
6
+ ## overview
7
+ The uploading of [rials I18N](http://guides.rubyonrails.org/i18n.html) files to smartling, monitoring their translation status, and pulling them all back down into your `config/localization` folder is a very manual process.
8
+
9
+ We wanted to create a way to simplify the process of localization within our project workflow and automate as much of the process as possible.
10
+
11
+ This gem is a core part of that automation because it understands how to safely send I18N files to smarling and safely retrieve their translated counterparts back.
12
+
13
+ Translating files with smartling is now as easy a little configuration and two commands.
14
+
15
+
16
+ ## usage
17
+
18
+ ```
19
+ $> gem install smartling_rails
20
+ $> irb
21
+ -> require 'smartling_rails'
22
+ -> sr = SmartlingRails.processor
23
+
24
+ -> sr.get_file_statuses
25
+ Checking status for ["French fr-FR", "German de-DE", "Dutch nl-NL"]
26
+ fr-FR completed: false (158 / 161)
27
+ de-DE completed: true (161 / 161)
28
+ nl-NL completed: true (161 / 161)
29
+
30
+ -> sr.put_files
31
+ Uploading the english file to smartling to process:
32
+ uploading config/locales/en-us.yml to /files/[PROJECT_NAME]-[GIT_BRANCH_NAME]-en-us-.yml
33
+
34
+ -> sr.get_files
35
+ Checking status for ["French fr-FR", "German de-DE", "Dutch nl-NL"]
36
+
37
+ Downloading fr-FR:
38
+ file loaded...
39
+ Fixing Issues:
40
+ fixing tabs from 4 spaces to 2 space
41
+ removing space after branch root : \n to :\n
42
+ remove "---" from first line
43
+ yes, replaced dashes
44
+ converting smartling locale code to CB locale code
45
+
46
+ Downloading de-DE:
47
+ file loaded...
48
+ Fixing Issues:
49
+ fixing tabs from 4 spaces to 2 space
50
+ removing space after branch root : \n to :\n
51
+ remove "---" from first line
52
+ yes, replaced dashes
53
+ converting smartling locale code to CB locale code
54
+
55
+ Downloading nl-NL:
56
+ file loaded...
57
+ Fixing Issues:
58
+ fixing tabs from 4 spaces to 2 space
59
+ removing space after branch root : \n to :\n
60
+ remove "---" from first line
61
+ yes, replaced dashes
62
+ converting smartling locale code to CB locale code
63
+
64
+ ```
65
+
66
+ ## structure
67
+ The smartling_rails gem consists of 3 components
68
+
69
+ **the Config class**
70
+ The config class loads and provides access for the configuration of the gem and how it interacts with your local application as well as the smartling APIs:
71
+ - **api_key** the api key for your smarling account
72
+ - **project_id** the smartling project id
73
+ - **locales** the hash of locales you support (locally and/or on smarlting)
74
+
75
+ **the SmartlingProcessor class**
76
+ The smartling processor class is responsible for defining the commands of the gem. The ability to upload, download, and get status for the translations is done in this class.
77
+
78
+ **the SmartlingFile class**
79
+ The smartling file class is responsible for the processing of the smartling YAML response to correct a handful of YAML problems that occur when using Smartling's YAML service. These include, removal of '---' from the file's first line, converting 4 spaces per tab to 2 spaces, removing misc spaces after nodes, converting smartling codes to local codes (if needed).
80
+
81
+
82
+ ## configuration
83
+ The configuration of how smartling_rails processes information to/from your application and smarting is done in the following ways:
84
+
85
+ Local `.env` file
86
+ >SMARTLING_API_KEY=[your_smartling_api_key]
87
+
88
+ >SMARTLING_PROJECT_ID=[your_project_id]
89
+
90
+ ENV (pending)
91
+ Yaml (pending)
92
+
93
+ ## dependencies
94
+ smartling_rails is dependant on the [smartling gem](https://rubygems.org/gems/smartling) version 0.5.1 or higher.
95
+
@@ -21,10 +21,10 @@ module SmartlingRails
21
21
  File.open(".env", "rb") do |f|
22
22
  f.each_line do |line|
23
23
  key_val = line.split("=")
24
- @api_key = key_val[1].chop if key_val[0] == 'SMARTLING_API_KEY'
25
- @project_id = key_val[1].chop if key_val[0] == 'SMARTLING_PROJECT_ID'
24
+ @api_key = key_val[1].strip if key_val[0] == 'SMARTLING_API_KEY'
25
+ @project_id = key_val[1].strip if key_val[0] == 'SMARTLING_PROJECT_ID'
26
26
  end
27
- end
27
+ end unless !File.exist?('.env')
28
28
  end
29
29
 
30
30
  end
@@ -49,7 +49,7 @@ module SmartlingRails
49
49
  end
50
50
 
51
51
  def upload_file_path()
52
- "/files/adam-test-resume-en-us-[#{get_current_branch}].yml"
52
+ "/files/adam-test-resume-[#{get_current_branch}]-en-us-.yml"
53
53
  end
54
54
 
55
55
  def get_files
@@ -1,3 +1,3 @@
1
1
  module SmartlingRails
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartling_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - The CareerBuilder.com Consumer Development teams