ios_localizer 0.0.1 → 0.0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +104 -0
- data/images/Add Language.png +0 -0
- data/images/Localize.png +0 -0
- data/ios_localizer.gemspec +3 -6
- data/lib/ios_localizer/version.rb +1 -1
- metadata +10 -52
data/README.md
CHANGED
@@ -1 +1,105 @@
|
|
1
|
+
iOS Localizer
|
2
|
+
=============
|
1
3
|
|
4
|
+
A Ruby gem that makes it easy to localize iOS applications.
|
5
|
+
|
6
|
+
This gem uses [Google Translate's REST API] to translate all the Localizable.strings
|
7
|
+
files generated by XCode to the file's respective language.
|
8
|
+
|
9
|
+
Created by Daniel Olshansky ([@olshansky]) and Amandeep Grewal ([@amandeep]).
|
10
|
+
|
11
|
+
Prerequisites
|
12
|
+
-------------
|
13
|
+
|
14
|
+
### 1. API Access
|
15
|
+
|
16
|
+
Google's translating services cost $20 per 1M characters so you must get
|
17
|
+
a valid key prior to using this gem.
|
18
|
+
|
19
|
+
Go to the [Google APIs Console]. Under *Services*, enable *Translate API* and complete the required
|
20
|
+
forms to enable payments.
|
21
|
+
|
22
|
+
### 2. Localizing your strings
|
23
|
+
|
24
|
+
I would also personally recommend that all the strings displayed to the user
|
25
|
+
should be removed from any .nib files and added via code to make your
|
26
|
+
project more systematic and easier to manage.
|
27
|
+
|
28
|
+
Any string displayed to the User must be formatted in the following way:
|
29
|
+
```
|
30
|
+
NSLocalizedString(@"String to be displayed", @"Comment about the string");
|
31
|
+
```
|
32
|
+
|
33
|
+
### 3. Localizable.strings files
|
34
|
+
|
35
|
+
Create a new Strings file:
|
36
|
+
- Go to *File > New > File*
|
37
|
+
- On the left hand side go to Resource (iOS or OS X depending on the application)
|
38
|
+
and choose *Strings File*. Call the file *Localizable.strings*.
|
39
|
+
|
40
|
+
Select the new Localizable.strings file and make it localizable by clicking the *[Make localized]* button.
|
41
|
+
|
42
|
+
### 4. Adding new languages
|
43
|
+
|
44
|
+
Adding an additional language is very simple with XCode. [This image] shows you where
|
45
|
+
you can choose to add or remove languages that application should be localized for depending on who your target
|
46
|
+
demographic.
|
47
|
+
|
48
|
+
Installation
|
49
|
+
------------
|
50
|
+
```
|
51
|
+
gem install ios_localizer
|
52
|
+
```
|
53
|
+
|
54
|
+
Usage
|
55
|
+
-----
|
56
|
+
* Navigate into your project's directory in terminal:
|
57
|
+
|
58
|
+
i.e. ```cd ~/Documents/workspace/ExampleProjectName/ ```
|
59
|
+
|
60
|
+
* The most common use case of the gem would then be:
|
61
|
+
|
62
|
+
i.e. ```ios_localizer -k YoureKeyHere1234567890 ```
|
63
|
+
|
64
|
+
* If the source language is not english, you can specify it as follows:
|
65
|
+
|
66
|
+
i.e. ```ios_localizer -k YoureKeyHere1234567890 -s nl```
|
67
|
+
|
68
|
+
where `nl` is the ISO 639 representation of the source language
|
69
|
+
|
70
|
+
* If you have already run the script but added a new localization
|
71
|
+
language afterwards, you can avoid retranslating (and wasting your credit) as follows:
|
72
|
+
|
73
|
+
i.e. ```ios_localizer -k YoureKeyHere1234567890 -n la -n lb -n lc```
|
74
|
+
|
75
|
+
where `la`, `lb` and `lc` are the ISO 639 representations of the languages you
|
76
|
+
would like to avoid translating to (given that you have added them in
|
77
|
+
XCode under Localizations).
|
78
|
+
|
79
|
+
Contributing
|
80
|
+
------------
|
81
|
+
Any and all pull requests are welcome!
|
82
|
+
|
83
|
+
Copyright and license
|
84
|
+
---------------------
|
85
|
+
|
86
|
+
Copyright 2012 Daniel Olshansky & Amandeep Grewal
|
87
|
+
|
88
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
89
|
+
you may not use this work except in compliance with the License.
|
90
|
+
You may obtain a copy of the License in the LICENSE file, or at:
|
91
|
+
|
92
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
93
|
+
|
94
|
+
Unless required by applicable law or agreed to in writing, software
|
95
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
96
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
97
|
+
See the License for the specific language governing permissions and
|
98
|
+
limitations under the License.
|
99
|
+
|
100
|
+
[@olshansky]: http://twitter.com/olshansky
|
101
|
+
[@amandeep]: http://twitter.com/amandeep
|
102
|
+
[Google APIs Console]: https://code.google.com/apis/console/
|
103
|
+
[Google Translate's REST API]: https://developers.google.com/translate/v2/using_rest
|
104
|
+
[This image]: https://github.com/Olshansk/ios_localizer/raw/master/images/Add%20Language.png
|
105
|
+
[Make localized]: https://github.com/Olshansk/ios_localizer/raw/master/images/Localize.png
|
Binary file
|
data/images/Localize.png
ADDED
Binary file
|
data/ios_localizer.gemspec
CHANGED
@@ -5,6 +5,7 @@ require 'ios_localizer/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "ios_localizer"
|
8
|
+
gem.date = Date.today
|
8
9
|
gem.version = IosLocalizer::VERSION
|
9
10
|
gem.authors = ["Daniel Olshansky", "Amandeep Grewal"]
|
10
11
|
gem.email = ["olshansky.daniel@gmail.com", "me@amandeep.ca"]
|
@@ -17,11 +18,7 @@ Gem::Specification.new do |gem|
|
|
17
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
19
|
gem.require_paths = ["lib"]
|
19
20
|
|
20
|
-
gem.
|
21
|
-
gem.
|
22
|
-
gem.add_development_dependency "json"
|
23
|
-
gem.add_development_dependency "cgi"
|
24
|
-
gem.add_development_dependency "htmlentities"
|
25
|
-
gem.add_development_dependency "optparse"
|
21
|
+
gem.add_dependency "json"
|
22
|
+
gem.add_dependency "htmlentities"
|
26
23
|
|
27
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ios_localizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1
|
4
|
+
version: 0.0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,75 +10,31 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-09-
|
13
|
+
date: 2012-09-10 00:00:00.000000000 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
17
|
-
name: uri
|
18
|
-
requirement: &70338768892080 !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
|
-
requirements:
|
21
|
-
- - ! '>='
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: '0'
|
24
|
-
type: :development
|
25
|
-
prerelease: false
|
26
|
-
version_requirements: *70338768892080
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: net/https
|
29
|
-
requirement: &70338768891600 !ruby/object:Gem::Requirement
|
30
|
-
none: false
|
31
|
-
requirements:
|
32
|
-
- - ! '>='
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: *70338768891600
|
38
16
|
- !ruby/object:Gem::Dependency
|
39
17
|
name: json
|
40
|
-
requirement: &
|
18
|
+
requirement: &70328367060260 !ruby/object:Gem::Requirement
|
41
19
|
none: false
|
42
20
|
requirements:
|
43
21
|
- - ! '>='
|
44
22
|
- !ruby/object:Gem::Version
|
45
23
|
version: '0'
|
46
|
-
type: :
|
24
|
+
type: :runtime
|
47
25
|
prerelease: false
|
48
|
-
version_requirements: *
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: cgi
|
51
|
-
requirement: &70338768890640 !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
|
-
requirements:
|
54
|
-
- - ! '>='
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '0'
|
57
|
-
type: :development
|
58
|
-
prerelease: false
|
59
|
-
version_requirements: *70338768890640
|
26
|
+
version_requirements: *70328367060260
|
60
27
|
- !ruby/object:Gem::Dependency
|
61
28
|
name: htmlentities
|
62
|
-
requirement: &
|
63
|
-
none: false
|
64
|
-
requirements:
|
65
|
-
- - ! '>='
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: '0'
|
68
|
-
type: :development
|
69
|
-
prerelease: false
|
70
|
-
version_requirements: *70338768890140
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: optparse
|
73
|
-
requirement: &70338768889660 !ruby/object:Gem::Requirement
|
29
|
+
requirement: &70328367059800 !ruby/object:Gem::Requirement
|
74
30
|
none: false
|
75
31
|
requirements:
|
76
32
|
- - ! '>='
|
77
33
|
- !ruby/object:Gem::Version
|
78
34
|
version: '0'
|
79
|
-
type: :
|
35
|
+
type: :runtime
|
80
36
|
prerelease: false
|
81
|
-
version_requirements: *
|
37
|
+
version_requirements: *70328367059800
|
82
38
|
description: Uses Google Translate's REST API to properly translate the source Localizable.strings
|
83
39
|
file to each of the specified languages
|
84
40
|
email:
|
@@ -95,6 +51,8 @@ files:
|
|
95
51
|
- README.md
|
96
52
|
- Rakefile
|
97
53
|
- bin/ios_localizer
|
54
|
+
- images/Add Language.png
|
55
|
+
- images/Localize.png
|
98
56
|
- ios_localizer.gemspec
|
99
57
|
- lib/ios_localizer.rb
|
100
58
|
- lib/ios_localizer/version.rb
|