r18n-rails-api 3.0.5 → 3.1.1
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.
- checksums.yaml +4 -4
- data/README.md +0 -20
- data/r18n-rails-api.gemspec +2 -2
- data/spec/filters_spec.rb +0 -12
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c33bb52ec35f57070d00abfb1c8413397b60d9e04ff94dfae06abe7c0d67b5d9
|
4
|
+
data.tar.gz: 7a18d339a806d9dafb33ca8c628c746fb84168a94bbd40f9f75e61b131e72ad7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 295c9dc50fe1fcc5579bbb1d1effaf0186a5c7a75fe4e048ea8080941dc423202f8dd71b577dfac6a828d4c8e3fbe1bebaed7c3f49350275806d615caca2432f
|
7
|
+
data.tar.gz: f1c9ac9fd7e48bf02d13b37d9fed2f956ef43da946b96c9d3e3013902e14482e9eee9b7f0748bf355ceadf9fcf048bea75f492f0f1865a158d25986a7039dcc5
|
data/README.md
CHANGED
@@ -1,31 +1,11 @@
|
|
1
1
|
# R18n Rails API
|
2
2
|
|
3
3
|
Rails I18n compatibility for R18n:
|
4
|
-
* filters to work with named variables in Rails translation format;
|
5
4
|
* R18n loader for Rails I18n translation format;
|
6
5
|
* R18n backend.
|
7
6
|
|
8
7
|
## How To
|
9
8
|
|
10
|
-
### Variables
|
11
|
-
|
12
|
-
After require-ing `r18n-rails-api` you can use named variables in all
|
13
|
-
translations:
|
14
|
-
|
15
|
-
```yaml
|
16
|
-
greeting: "Hi, %{name}"
|
17
|
-
users: !!pl
|
18
|
-
1: One user
|
19
|
-
n: %{count} users
|
20
|
-
```
|
21
|
-
|
22
|
-
```ruby
|
23
|
-
require 'r18n-rails-api'
|
24
|
-
|
25
|
-
i18n.greeting(name: 'John') #=> "Hi, John"
|
26
|
-
i18n.users(count: 5) #=> "5 users"
|
27
|
-
```
|
28
|
-
|
29
9
|
### Rails Translations
|
30
10
|
|
31
11
|
You can use `R18n::Loader::Rails` to load translations from `I18n.load_path`:
|
data/r18n-rails-api.gemspec
CHANGED
@@ -26,8 +26,8 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.author = 'Andrey Sitnik'
|
27
27
|
s.email = 'andrey@sitnik.ru'
|
28
28
|
s.homepage = 'https://github.com/ai/r18n/tree/master/r18n-rails-api'
|
29
|
-
s.license = 'LGPL-3'
|
29
|
+
s.license = 'LGPL-3.0'
|
30
30
|
|
31
|
-
s.add_dependency 'i18n'
|
31
|
+
s.add_dependency 'i18n', '~> 1'
|
32
32
|
s.add_dependency 'r18n-core', "= #{R18n::VERSION}"
|
33
33
|
end
|
data/spec/filters_spec.rb
CHANGED
@@ -1,18 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe 'Rails filters' do
|
4
|
-
it 'uses named variables' do
|
5
|
-
i18n = R18n::Translation.new(
|
6
|
-
EN, '', locale: EN, translations: { 'echo' => 'Value is %{value}' }
|
7
|
-
)
|
8
|
-
|
9
|
-
expect(i18n.echo(value: 'R18n')).to eq 'Value is R18n'
|
10
|
-
expect(i18n.echo(value: -5.5)).to eq 'Value is −5.5'
|
11
|
-
expect(i18n.echo(value: 5000)).to eq 'Value is 5,000'
|
12
|
-
expect(i18n.echo(value: '<b>')).to eq 'Value is <b>'
|
13
|
-
expect(i18n.echo).to eq 'Value is %{value}'
|
14
|
-
end
|
15
|
-
|
16
4
|
it 'uses old variables syntax' do
|
17
5
|
i18n = R18n::Translation.new(
|
18
6
|
EN, '', locale: EN, translations: { 'echo' => 'Value is {{value}}' }
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r18n-rails-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Sitnik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: r18n-core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
33
|
+
version: 3.1.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.
|
40
|
+
version: 3.1.1
|
41
41
|
description: |2
|
42
42
|
R18n backend for Rails I18n and R18n filters and loader to support Rails
|
43
43
|
translation format.
|
@@ -77,7 +77,7 @@ files:
|
|
77
77
|
- spec/spec_helper.rb
|
78
78
|
homepage: https://github.com/ai/r18n/tree/master/r18n-rails-api
|
79
79
|
licenses:
|
80
|
-
- LGPL-3
|
80
|
+
- LGPL-3.0
|
81
81
|
metadata: {}
|
82
82
|
post_install_message:
|
83
83
|
rdoc_options: []
|