translation 1.11 → 1.12
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: 0703f3809469bb31e2920027e43545d2ffd3a6cc
|
4
|
+
data.tar.gz: 638e3671e6fbf938d83d30a9874b0e3262249128
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03ff7f12b1b18122708206e268509cbb991c4b271721cb36d13c8efb992695cb94b1f67c289024fbf43080baaf2e7348818cfd9d81dc4635bcbc2540255fa9c8
|
7
|
+
data.tar.gz: 8c55a73db859e666eed08bae9846e2fc1973b492807af4718bc5f7ef29ece350d4b1d74626a328895a6e9bc74864e5522ae8c06de8105b6d0ad626fc4f0ad608
|
data/README.md
CHANGED
@@ -1,13 +1,39 @@
|
|
1
|
-
# Gem for [Translation.io](http://translation.io)
|
1
|
+
# Gem for [Translation.io](http://translation.io) [ ![Codeship Status](https://app.codeship.com/projects/f7cd4ac0-b73c-0131-51ea-522dcd2196ed/status?branch=master)](https://app.codeship.com/projects/20528) [![Test Coverage](https://codeclimate.com/github/aurels/translation-gem/badges/coverage.svg)](https://codeclimate.com/github/aurels/translation-gem/coverage)
|
2
2
|
|
3
|
-
Add this gem to your [Rails](http://rubyonrails.org) application to localize
|
4
|
-
|
5
|
-
[GetText](https://github.com/ruby-gettext/gettext) syntaxes.
|
3
|
+
Add this gem to your [Rails](http://rubyonrails.org) application to localize it using
|
4
|
+
[I18n (YAML)](#i18n-yaml) or [GetText](#gettext) syntaxes.
|
6
5
|
|
7
6
|
Keep it synchronized with your translators on [Translation.io](https://translation.io).
|
8
7
|
|
8
|
+
[![Image](https://github.com/aurels/translation-gem/raw/master/interface.png)](https://translation.io)
|
9
|
+
|
9
10
|
Need help? [contact@translation.io](mailto:contact@translation.io)
|
10
11
|
|
12
|
+
Table of contents
|
13
|
+
=================
|
14
|
+
|
15
|
+
* [Installation](#installation)
|
16
|
+
* [Translation syntaxes](#translation-syntaxes)
|
17
|
+
* [I18n (YAML)](#i18n-yaml)
|
18
|
+
* [GetText](#gettext)
|
19
|
+
* [Usage](#usage)
|
20
|
+
* [Sync](#sync)
|
21
|
+
* [Sync and Show Purgeable](#sync-and-show-purgeable)
|
22
|
+
* [Sync and Purge](#sync-and-purge)
|
23
|
+
* [Advanced Configuration Options](#advanced-configuration-options)
|
24
|
+
* [Disable GetText](#disable-gettext)
|
25
|
+
* [Ignored YAML keys](#ignored-yaml-keys)
|
26
|
+
* [Source file formats (for GetText)](#source-file-formats-for-gettext)
|
27
|
+
* [Custom localization key prefixes](#custom-localization-key-prefixes)
|
28
|
+
* [Paths where locales are stored (not recommended)](#paths-where-locales-are-stored-not-recommended)
|
29
|
+
* [Pure Ruby (without Rails)](#pure-ruby-without-rails)
|
30
|
+
* [Other implementations](#other-implementations)
|
31
|
+
* [React and React-Intl (JavaScript)](#react-and-react-intl-javascript)
|
32
|
+
* [Laravel (PHP)](#laravel-php)
|
33
|
+
* [Tests](#tests)
|
34
|
+
* [Contributing](#contributing)
|
35
|
+
* [Credits](#credits)
|
36
|
+
|
11
37
|
## Installation
|
12
38
|
|
13
39
|
1. Add the gem to your project's Gemfile:
|
@@ -34,10 +60,12 @@ end
|
|
34
60
|
If you later need to add/remove target languages, please read our
|
35
61
|
[documentation](https://translation.io/blog/adding-target-languages) about that.
|
36
62
|
|
37
|
-
##
|
63
|
+
## Translation syntaxes
|
38
64
|
|
39
65
|
#### I18n (YAML)
|
40
66
|
|
67
|
+
The default [Rails Internationalization API](http://guides.rubyonrails.org/i18n.html).
|
68
|
+
|
41
69
|
```ruby
|
42
70
|
# Regular
|
43
71
|
t('inbox.title')
|
@@ -64,10 +92,11 @@ en:
|
|
64
92
|
|
65
93
|
You can keep your source YAML file automatically updated using [i18n-tasks](https://github.com/glebm/i18n-tasks).
|
66
94
|
|
67
|
-
More information about I18n usage [here](http://guides.rubyonrails.org/i18n.html).
|
68
|
-
|
69
95
|
#### GetText
|
70
96
|
|
97
|
+
This gem adds the GetText support to Rails. We [strongly suggest](https://translation.io/blog/gettext-is-better-than-rails-i18n)
|
98
|
+
that you use GetText to translate your applications since it allows a simpler and more maintainable syntax.
|
99
|
+
|
71
100
|
```ruby
|
72
101
|
# Regular
|
73
102
|
_("text to be translated")
|
@@ -78,7 +107,7 @@ n_("singular text", "plural text", number)
|
|
78
107
|
# Regular with context
|
79
108
|
p_("context", "text to be translated")
|
80
109
|
|
81
|
-
# Plural management with
|
110
|
+
# Plural management with context
|
82
111
|
np_("context", "singular text", "plural text", number)
|
83
112
|
|
84
113
|
# Interpolations
|
@@ -87,13 +116,15 @@ _('%{city1} is bigger than %{city2}') % { city1: "NYC", city2: "BXL" }
|
|
87
116
|
|
88
117
|
More information about GetText usage [here](https://github.com/ruby-gettext/gettext#usage).
|
89
118
|
|
90
|
-
##
|
119
|
+
## Usage
|
120
|
+
|
121
|
+
#### Sync
|
91
122
|
|
92
123
|
To send new translatable keys/strings and get new translations from Translation.io, simply run:
|
93
124
|
|
94
125
|
bundle exec rake translation:sync
|
95
126
|
|
96
|
-
|
127
|
+
#### Sync and Show Purgeable
|
97
128
|
|
98
129
|
If you need to see what are the unused keys/strings from Translation.io, using the current branch as reference:
|
99
130
|
|
@@ -101,7 +132,7 @@ If you need to see what are the unused keys/strings from Translation.io, using t
|
|
101
132
|
|
102
133
|
As the name says, this operation will also perform a sync at the same time.
|
103
134
|
|
104
|
-
|
135
|
+
#### Sync and Purge
|
105
136
|
|
106
137
|
If you need to remove unused keys/strings from Translation.io, using the current branch as reference:
|
107
138
|
|
@@ -213,12 +244,6 @@ TranslationIO.configure do |config|
|
|
213
244
|
end
|
214
245
|
```
|
215
246
|
|
216
|
-
## Tests
|
217
|
-
|
218
|
-
To run the specs:
|
219
|
-
|
220
|
-
bundle exec rspec
|
221
|
-
|
222
247
|
## Pure Ruby (without Rails)
|
223
248
|
|
224
249
|
This gem was created specifically for Rails, but you can also use it in a pure Ruby project by making some arrangements:
|
@@ -283,8 +308,8 @@ Thanks a lot to these contributors for their hard work!
|
|
283
308
|
|
284
309
|
#### React and React-Intl (JavaScript)
|
285
310
|
|
286
|
-
* GitHub: https://github.com/deecewan/translation-io
|
287
|
-
* NPM: https://www.npmjs.com/package/translation-io
|
311
|
+
* GitHub: https://github.com/deecewan/translation-io
|
312
|
+
* NPM: https://www.npmjs.com/package/translation-io
|
288
313
|
|
289
314
|
Credit: [@deecewan](https://github.com/deecewan)
|
290
315
|
|
@@ -295,6 +320,16 @@ Credit: [@deecewan](https://github.com/deecewan)
|
|
295
320
|
|
296
321
|
Credit: [@armandsar](https://github.com/armandsar)
|
297
322
|
|
323
|
+
## Tests
|
324
|
+
|
325
|
+
To run the specs:
|
326
|
+
|
327
|
+
bundle exec rspec
|
328
|
+
|
329
|
+
## Contributing
|
330
|
+
|
331
|
+
Please read the [CONTRIBUTING](https://github.com/aurels/translation-gem/blob/master/CONTRIBUTING.md) file.
|
332
|
+
|
298
333
|
## Credits
|
299
334
|
|
300
335
|
The [translation gem](https://rubygems.org/gems/translation) in released under MIT license by
|
@@ -39,14 +39,14 @@ module TranslationIO
|
|
39
39
|
return parsed_response
|
40
40
|
elsif response.code.to_i == 400 && parsed_response.has_key?('error')
|
41
41
|
$stderr.puts "[Error] #{parsed_response['error']}"
|
42
|
-
exit
|
42
|
+
exit(false)
|
43
43
|
else
|
44
44
|
$stderr.puts "[Error] Unknown error from the server: #{response.code}."
|
45
|
-
exit
|
45
|
+
exit(false)
|
46
46
|
end
|
47
47
|
rescue Errno::ECONNREFUSED
|
48
48
|
$stderr.puts "[Error] Server not responding."
|
49
|
-
exit
|
49
|
+
exit(false)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -67,7 +67,7 @@ module TranslationIO
|
|
67
67
|
input = STDIN.gets.strip
|
68
68
|
|
69
69
|
if input != 'y' && input != 'Y'
|
70
|
-
exit(
|
70
|
+
exit(true)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
@@ -88,7 +88,7 @@ module TranslationIO
|
|
88
88
|
input = STDIN.gets.strip
|
89
89
|
|
90
90
|
if input != 'y' && input != 'Y'
|
91
|
-
exit(
|
91
|
+
exit(true)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
@@ -78,7 +78,7 @@ module TranslationIO
|
|
78
78
|
|
79
79
|
if metadata_content.include?('>>>>') || metadata_content.include?('<<<<')
|
80
80
|
TranslationIO.info "[Error] #{TranslationIO.config.metadata_path} file is corrupted and seems to have unresolved versioning conflicts. Please resolve them and try again."
|
81
|
-
exit
|
81
|
+
exit(false)
|
82
82
|
else
|
83
83
|
return YAML::load(metadata_content)['timestamp'] rescue 0
|
84
84
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: translation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.12'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aurelien Malisart
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gettext
|