smartling_rails 0.0.5 → 0.0.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be7456374b7698705e6e06a11db580ba08e71215
|
4
|
+
data.tar.gz: e32baa526d157410b503a5c9dab12d77df873dc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 082e1613ebb127b5a50954f2ba6d927549c3f33b54169629015952530d21f5b097fe8b9c262366e575ceb7cbea4ba92cdc299e886b1ac0876441c6c1a49073b1
|
7
|
+
data.tar.gz: 704ca6f4b7e0db29279fe2ecbfe4f16e53ce8e3c384c3a8168e43e10330b0b5c21857bed747d0cfdc7b8b18aa0f513b1b8c9c84e6d9e1ae4fd985a62087ed945
|
data/README.md
CHANGED
data/lib/smartling_rails.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'smartling'
|
2
|
+
require 'yaml'
|
3
|
+
|
2
4
|
Dir[File.dirname(__FILE__) + '/smartling_rails/**/*.rb'].each { |file| require file }
|
3
5
|
|
4
6
|
module SmartlingRails
|
@@ -12,15 +14,15 @@ module SmartlingRails
|
|
12
14
|
end
|
13
15
|
|
14
16
|
def self.api_key
|
15
|
-
|
17
|
+
configuration.api_key
|
16
18
|
end
|
17
19
|
|
18
20
|
def self.project_id
|
19
|
-
|
21
|
+
configuration.project_id
|
20
22
|
end
|
21
23
|
|
22
24
|
def self.locales
|
23
|
-
|
25
|
+
configuration.locales
|
24
26
|
end
|
25
27
|
|
26
28
|
def self.processor
|
@@ -3,20 +3,16 @@ module SmartlingRails
|
|
3
3
|
attr_accessor :api_key, :project_id, :rails_app_name, :locales
|
4
4
|
|
5
5
|
def initialize
|
6
|
-
|
7
|
-
puts "locales should source from a yaml file"
|
8
|
-
@locales = {French: {smartling:'fr-FR', careerbuilder:'fr-fr'},
|
9
|
-
German: {smartling:'de-DE', careerbuilder:'de-de'},
|
10
|
-
Dutch: {smartling:'nl-NL', careerbuilder:'nl-nl'},
|
11
|
-
Italian: {smartling:'it-IT', careerbuilder:'it-it'},
|
12
|
-
Swedish: {smartling:'sv-SE', careerbuilder:'se-se'},
|
13
|
-
Chinese: {smartling:'zh-CN', careerbuilder:'zh-cn'},
|
14
|
-
Spanish: {smartling:'es-ES', careerbuilder:'es-es'},
|
15
|
-
FrenchCanadian: {smartling:'fr-CA', careerbuilder:'fr-ca'},
|
16
|
-
Greek: {smartling:'el-GR', careerbuilder:'gr-gr'}}
|
6
|
+
load_locales_from_yaml
|
17
7
|
import_env_variables()
|
18
8
|
end
|
19
9
|
|
10
|
+
def load_locales_from_yaml
|
11
|
+
config_file_path = 'config/smartling_rails.yml'
|
12
|
+
throw "Localization File Missing '/config/smartling_rails.yml'" unless File.exist?(config_file_path)
|
13
|
+
@locales = YAML::load_file(config_file_path)['locales']
|
14
|
+
end
|
15
|
+
|
20
16
|
def import_env_variables
|
21
17
|
File.open(".env", "rb") do |f|
|
22
18
|
f.each_line do |line|
|
@@ -36,7 +36,7 @@ module SmartlingRails
|
|
36
36
|
|
37
37
|
def fix_locale_root_node
|
38
38
|
puts ' converting smartling locale code to CB locale code'
|
39
|
-
@file_contents.sub!(locale_codes[
|
39
|
+
@file_contents.sub!(locale_codes['smartling'],locale_codes['custom'])
|
40
40
|
end
|
41
41
|
|
42
42
|
def print_contents
|
@@ -13,12 +13,12 @@ module SmartlingRails
|
|
13
13
|
def get_file_statuses
|
14
14
|
SmartlingRails.print_msg("Checking status for #{supported_locales}", true)
|
15
15
|
SmartlingRails.locales.each do |language, codes|
|
16
|
-
check_file_status(codes[
|
16
|
+
check_file_status(codes['smartling'])
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
def supported_locales
|
21
|
-
SmartlingRails.locales.map { |language, codes| language.to_s + ' ' + codes[
|
21
|
+
SmartlingRails.locales.map { |language, codes| language.to_s + ' ' + codes['smartling'] }
|
22
22
|
end
|
23
23
|
|
24
24
|
def check_file_status(language_code)
|
@@ -48,7 +48,7 @@ module SmartlingRails
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def upload_file_path()
|
51
|
-
"/files/[#{SmartlingRails.configuration.rails_app_name}]-[#{get_current_branch}]-en-us.yml"
|
51
|
+
"/files/[#{SmartlingRails.configuration.rails_app_name || 'app'}]-[#{get_current_branch}]-en-us.yml"
|
52
52
|
end
|
53
53
|
|
54
54
|
def get_files
|
@@ -61,12 +61,12 @@ module SmartlingRails
|
|
61
61
|
def fetch_fix_and_save_file_for_locale(locale_codes)
|
62
62
|
smartling_file = get_file_for_locale(locale_codes)
|
63
63
|
smartling_file.fix_file_issues()
|
64
|
-
save_to_local_file(smartling_file.file_contents, locale_codes[
|
64
|
+
save_to_local_file(smartling_file.file_contents, locale_codes['custom'])
|
65
65
|
end
|
66
66
|
|
67
67
|
def get_file_for_locale(locale_codes)
|
68
68
|
smartling_file = SmartlingFile.new('', locale_codes)
|
69
|
-
SmartlingRails.print_msg "Downloading #{locale_codes[
|
69
|
+
SmartlingRails.print_msg "Downloading #{locale_codes['smartling']}:", true
|
70
70
|
begin
|
71
71
|
smartling_file.file_contents = @my_smartling.download(upload_file_path, :locale => locale_codes[:smartling])
|
72
72
|
SmartlingRails.print_msg "file loaded..."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartling_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The CareerBuilder.com Consumer Development teams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: smartling
|