translation 1.26 → 1.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +36 -12
- data/lib/translation_io/client/init_operation.rb +2 -2
- data/lib/translation_io/client/sync_operation.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 560509444fb20c870be092d51b8bf43b753136ce3247ed351aefe76971ee0c3d
|
4
|
+
data.tar.gz: f5a9a1a2171d3705f59ef7e5d7573f1f2114e67de7ecd3105b8fbb6e4d78f947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36a33b3403e5e31fe9c79692bd31816b8f0d4b27f59d5a9271a8aebc76e06086c1afbe1cbdebd9da13b9844116a3f3f85b168f6f4916940100822ec67e87882f
|
7
|
+
data.tar.gz: 94e2507fd8fcb01067b4281cd6a5df23e3943e1ad43a981a17700c1d95b0071865a24b29fb9a9508a1a701a4b6dc93bed698c2052eba031d269cc7e1b32f8bf0
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
[![Gem Version](https://badgen.net/rubygems/v/translation)](https://rubygems.org/gems/translation)
|
7
7
|
[![Downloads](https://img.shields.io/gem/dt/translation.svg)](https://rubygems.org/gems/translation)
|
8
8
|
|
9
|
-
Add this gem to localize your Ruby on Rails application.
|
9
|
+
Add this gem to localize your **Ruby on Rails** application.
|
10
10
|
|
11
11
|
Use the official Rails syntax (with [YAML](#i18n-yaml) files) or use the [GetText](#gettext) syntax.
|
12
12
|
|
@@ -40,6 +40,8 @@ Table of contents
|
|
40
40
|
* [Globally](#globally)
|
41
41
|
* [Locally](#locally)
|
42
42
|
* [Frontend Localization](#frontend-localization)
|
43
|
+
* [Using this Gem](#using-this-gem)
|
44
|
+
* [Using our official React & JavaScript package](#using-our-official-react--javascript-package)
|
43
45
|
* [Continuous Integration](#continuous-integration)
|
44
46
|
* [Advanced Configuration Options](#advanced-configuration-options)
|
45
47
|
* [Disable GetText or YAML](#disable-gettext-or-yaml)
|
@@ -55,7 +57,7 @@ Table of contents
|
|
55
57
|
* [List of clients for Translation.io](#list-of-clients-for-translationio)
|
56
58
|
* [Ruby on Rails (Ruby)](#ruby-on-rails-ruby)
|
57
59
|
* [Laravel (PHP)](#laravel-php)
|
58
|
-
* [React and
|
60
|
+
* [React, React Native and JavaScript](#react-react-native-and-javascript)
|
59
61
|
* [Others](#others)
|
60
62
|
* [License](#license)
|
61
63
|
|
@@ -145,7 +147,7 @@ end
|
|
145
147
|
$ bundle exec rake translation:init
|
146
148
|
```
|
147
149
|
|
148
|
-
If you
|
150
|
+
If you need to add or remove languages in the future, please read our
|
149
151
|
[documentation](https://translation.io/blog/adding-target-languages) about that.
|
150
152
|
|
151
153
|
## Usage
|
@@ -178,7 +180,8 @@ $ bundle exec rake translation:sync_and_purge
|
|
178
180
|
|
179
181
|
As the name says, this operation will also perform a sync at the same time.
|
180
182
|
|
181
|
-
Warning: all keys that are not present in the current branch
|
183
|
+
Warning: all keys that are not present in the current local branch
|
184
|
+
will be **permanently deleted from Translation.io**.
|
182
185
|
|
183
186
|
## Manage Languages
|
184
187
|
|
@@ -287,6 +290,8 @@ More examples here: https://translation.io/blog/rails-i18n-with-locale
|
|
287
290
|
|
288
291
|
## Frontend Localization
|
289
292
|
|
293
|
+
### Using this Gem
|
294
|
+
|
290
295
|
This gem is also able to cover frontend localization (React, Vue, ...).
|
291
296
|
|
292
297
|
There are several ways to pass the translation strings from the backend
|
@@ -299,10 +304,12 @@ Assuming that you use [reactjs/react-rails](https://github.com/reactjs/react-rai
|
|
299
304
|
it would look like this if you want to use [I18n (YAML)](#i18n-yaml) syntax:
|
300
305
|
|
301
306
|
```erb
|
302
|
-
<%=
|
307
|
+
<%=
|
308
|
+
react_component('MyComponent", {
|
303
309
|
:user_id => current_user.id,
|
304
310
|
:i18n => YAML.load_file("config/locales/#{I18n.locale}.yml")[I18n.locale.to_s]["my_component"]
|
305
|
-
})
|
311
|
+
})
|
312
|
+
%>
|
306
313
|
```
|
307
314
|
|
308
315
|
Your `en.yml` should look like this:
|
@@ -317,13 +324,15 @@ en:
|
|
317
324
|
You can also directly use the [GetText](#gettext) syntax:
|
318
325
|
|
319
326
|
```erb
|
320
|
-
<%=
|
327
|
+
<%=
|
328
|
+
react_component('MyComponent", {
|
321
329
|
:user_id => current_user.id,
|
322
330
|
:i18n => {
|
323
331
|
:your_name => _('Your name'),
|
324
332
|
:title => _('Title')
|
325
333
|
}
|
326
|
-
})
|
334
|
+
})
|
335
|
+
%>
|
327
336
|
```
|
328
337
|
|
329
338
|
In both case, in your React component, you can simply call
|
@@ -334,6 +343,18 @@ In both case, in your React component, you can simply call
|
|
334
343
|
* You can also structure the i18n props with multiple levels of depth and pass the subtree as props to each of your sub-components.
|
335
344
|
* It also works great with server-side rendering of your components (`:prerender => true`).
|
336
345
|
|
346
|
+
### Using our official React & JavaScript package
|
347
|
+
|
348
|
+
As Translation.io is directly integrated in the great
|
349
|
+
[Lingui](https://lingui.js.org/) internationalization framework,
|
350
|
+
you can also consider frontend localization as a completely different
|
351
|
+
localization project.
|
352
|
+
|
353
|
+
Please read more about this on:
|
354
|
+
|
355
|
+
* Website: [https://translation.io/lingui](https://translation.io/lingui)
|
356
|
+
* GitHub page: [https://github.com/translation/lingui](https://github.com/translation/lingui)
|
357
|
+
|
337
358
|
## Continuous Integration
|
338
359
|
|
339
360
|
If you want fresh translations in your Continuous Integration workflow, you may
|
@@ -597,12 +618,15 @@ Officially Supported on [https://translation.io/laravel](https://translation.io/
|
|
597
618
|
|
598
619
|
Credits: [@armandsar](https://github.com/armandsar), [@michaelhoste](https://github.com/michaelhoste)
|
599
620
|
|
600
|
-
### React and
|
621
|
+
### React, React Native and JavaScript
|
622
|
+
|
623
|
+
Officially Supported on [https://translation.io/lingui](https://translation.io/lingui)
|
601
624
|
|
602
|
-
|
603
|
-
|
625
|
+
Translation.io is directly integrated in the great
|
626
|
+
[Lingui](https://lingui.js.org/) internationalization project.
|
604
627
|
|
605
|
-
|
628
|
+
* GitHub: https://github.com/translation/lingui
|
629
|
+
* NPM: https://www.npmjs.com/package/@translation/lingui
|
606
630
|
|
607
631
|
### Others
|
608
632
|
|
@@ -13,8 +13,8 @@ module TranslationIO
|
|
13
13
|
haml_source_files = config.haml_source_files
|
14
14
|
slim_source_files = config.slim_source_files
|
15
15
|
pot_path = config.pot_path
|
16
|
-
source_locale = config.source_locale
|
17
|
-
target_locales = config.target_locales
|
16
|
+
source_locale = config.source_locale.to_s
|
17
|
+
target_locales = config.target_locales.map(&:to_s)
|
18
18
|
locales_path = config.locales_path
|
19
19
|
yaml_locales_path = config.yaml_locales_path
|
20
20
|
yaml_file_paths = config.yaml_file_paths
|
@@ -16,8 +16,8 @@ module TranslationIO
|
|
16
16
|
haml_source_files = config.haml_source_files
|
17
17
|
slim_source_files = config.slim_source_files
|
18
18
|
pot_path = config.pot_path
|
19
|
-
source_locale = config.source_locale
|
20
|
-
target_locales = config.target_locales
|
19
|
+
source_locale = config.source_locale.to_s
|
20
|
+
target_locales = config.target_locales.map(&:to_s)
|
21
21
|
locales_path = config.locales_path
|
22
22
|
yaml_locales_path = config.yaml_locales_path
|
23
23
|
yaml_file_paths = config.yaml_file_paths
|
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.27'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Hoste
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-10-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gettext
|