yml_gtranslate 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +39 -14
- data/lib/yml_gtranslate/version.rb +1 -1
- data/yml_gtranslate.gemspec +6 -4
- metadata +20 -4
data/README.md
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
# yml_gtranslate
|
|
2
2
|
|
|
3
|
-
yml_gtranslate is a convenience gem
|
|
4
|
-
It creates missing `*.yml` localization config files or updates the locale
|
|
3
|
+
yml_gtranslate is a convenience gem to get your rails localization process going quickly. It uses the Google Translate service (no API required though).
|
|
4
|
+
It creates missing `*.yml` localization config files or updates the locale files with missing keys and translates those missing keys.
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Use rubygems for installation:
|
|
10
|
+
|
|
11
|
+
$ gem install yml_gtranslate
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
or add this line to your application's Gemfile:
|
|
10
15
|
|
|
11
16
|
gem 'yml_gtranslate', :git => 'git://github.com/zenchief/yml_gtranslate.git'
|
|
12
17
|
|
|
@@ -15,21 +20,19 @@ And then execute:
|
|
|
15
20
|
|
|
16
21
|
$ bundle install
|
|
17
22
|
|
|
18
|
-
Or install it yourself as:
|
|
19
23
|
|
|
20
|
-
$ gem install yml_gtranslate
|
|
21
24
|
|
|
22
25
|
## Requirements
|
|
23
26
|
|
|
24
|
-
You need [sed](www.gnu.org/software/sed) on your system and in your $PATH.
|
|
27
|
+
You need [sed](www.gnu.org/software/sed) and [curl](curl.haxx.se) on your system and in your $PATH. Curl is for getting data and sed is used for handling comment tokens before and after transaltion.
|
|
25
28
|
|
|
26
29
|
## Usage
|
|
27
30
|
|
|
28
|
-
After installation
|
|
31
|
+
After installation use the command:
|
|
29
32
|
|
|
30
33
|
|
|
31
34
|
$ yml_gt <from_lang> <to_lang> [directory]
|
|
32
|
-
goes thru all `*from_lang.yml` files in the `
|
|
35
|
+
goes thru all `*from_lang.yml` files in the `directory`
|
|
33
36
|
the default dir is config/locales
|
|
34
37
|
|
|
35
38
|
|
|
@@ -41,22 +44,44 @@ Translates config/locales/*en.yml files to German
|
|
|
41
44
|
Translates all sk.yml files in the _current directory_ to English (hence the dot)
|
|
42
45
|
|
|
43
46
|
$ yml_gt sk en .
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
|
|
47
48
|
This is going to take your all your `config/locales/*en.yml` files and compare them with `config/locales/*de.yml` files.
|
|
48
49
|
(That is in case your locale files are divided, e.g. en.yml, devise.en.yml etc.). If the target file does not exist
|
|
49
50
|
it's going to create it and translate all string keys in the source file to German using Google Translate.
|
|
50
51
|
If the target file already exists it's gonna compare all the string keys in both source and target and translate only those missing in the target.
|
|
51
52
|
|
|
52
53
|
The translation adds a comment "#i18n-GT" after the translated key. This is to let you know, that this string was
|
|
53
|
-
generated by Google Translate and probably needs some fine tuning.
|
|
54
|
-
|
|
54
|
+
generated by Google Translate and probably needs some fine tuning (coz let's face it, GT is seldom perfect in translations).
|
|
55
|
+
|
|
56
|
+
###Example 1.
|
|
57
|
+
Completing and sorting locale files:
|
|
58
|
+
|
|
59
|
+
**en.yml**
|
|
60
|
+
```ruby
|
|
61
|
+
en:
|
|
62
|
+
oranges: "oranges"
|
|
63
|
+
apples: "apples"
|
|
64
|
+
cherries: "cherries"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**de.yml**
|
|
68
|
+
```ruby
|
|
69
|
+
de:
|
|
70
|
+
oranges: "my awesome deutsch translation: Orangen"
|
|
71
|
+
```ruby
|
|
72
|
+
|
|
73
|
+
Command `yml_gt en de .` will result in `de.yml` being updated to:
|
|
74
|
+
```ruby
|
|
75
|
+
de:
|
|
76
|
+
apples: "Äpfel" #i18n-GT
|
|
77
|
+
cherries: "Kirschen" #i18n-GT
|
|
78
|
+
oranges: "my awesome deutsch translation: Orangen"
|
|
79
|
+
```
|
|
55
80
|
|
|
56
81
|
|
|
57
82
|
## Contributing
|
|
58
83
|
|
|
59
|
-
A
|
|
84
|
+
A: Shoot me an email and we'll talk it over
|
|
60
85
|
|
|
61
86
|
**or**
|
|
62
87
|
|
data/yml_gtranslate.gemspec
CHANGED
|
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
|
|
|
8
8
|
gem.version = YmlGtranslate::VERSION
|
|
9
9
|
gem.authors = ["Stefan Mikula"]
|
|
10
10
|
gem.email = ["stef.mikula@gmail.com"]
|
|
11
|
-
gem.description = %q{Uses Google
|
|
12
|
-
gem.summary = %q{Translates your *.yml locale files using Google Translate (
|
|
11
|
+
gem.description = %q{Uses Google Translate service to translate your *.yml files in your Rails projects. Handy to get your localizations started fast.}
|
|
12
|
+
gem.summary = %q{Translates your *.yml locale files using Google Translate (no GT API).}
|
|
13
13
|
gem.homepage = ""
|
|
14
14
|
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
|
@@ -20,8 +20,10 @@ Gem::Specification.new do |gem|
|
|
|
20
20
|
gem.add_development_dependency 'rake'
|
|
21
21
|
gem.add_development_dependency 'rspec'
|
|
22
22
|
|
|
23
|
-
gem.
|
|
24
|
-
|
|
23
|
+
gem.add_runtime_dependency 'ya2yaml'
|
|
24
|
+
gem.add_runtime_dependency 'json'
|
|
25
25
|
|
|
26
|
+
|
|
27
|
+
|
|
26
28
|
|
|
27
29
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yml_gtranslate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -51,7 +51,23 @@ dependencies:
|
|
|
51
51
|
- - ! '>='
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: '0'
|
|
54
|
-
type: :
|
|
54
|
+
type: :runtime
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ! '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
- !ruby/object:Gem::Dependency
|
|
63
|
+
name: json
|
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
|
65
|
+
none: false
|
|
66
|
+
requirements:
|
|
67
|
+
- - ! '>='
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
type: :runtime
|
|
55
71
|
prerelease: false
|
|
56
72
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
73
|
none: false
|
|
@@ -59,7 +75,7 @@ dependencies:
|
|
|
59
75
|
- - ! '>='
|
|
60
76
|
- !ruby/object:Gem::Version
|
|
61
77
|
version: '0'
|
|
62
|
-
description: Uses Google
|
|
78
|
+
description: Uses Google Translate service to translate your *.yml files in your Rails
|
|
63
79
|
projects. Handy to get your localizations started fast.
|
|
64
80
|
email:
|
|
65
81
|
- stef.mikula@gmail.com
|
|
@@ -106,7 +122,7 @@ rubyforge_project:
|
|
|
106
122
|
rubygems_version: 1.8.24
|
|
107
123
|
signing_key:
|
|
108
124
|
specification_version: 3
|
|
109
|
-
summary: Translates your *.yml locale files using Google Translate (
|
|
125
|
+
summary: Translates your *.yml locale files using Google Translate (no GT API).
|
|
110
126
|
test_files:
|
|
111
127
|
- spec/lib/yml_gtranslate_spec.rb
|
|
112
128
|
- spec/spec_helper.rb
|