i18n-backend-side_by_side 1.1.0 → 1.3.0

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
  SHA256:
3
- metadata.gz: 4eb09d448c322c9e08438f478d0136d998580cddbd0ab4711355ebacb006b5bf
4
- data.tar.gz: ec83849a97886478c059f42fae7d6729acb14343c7f0b99eb60193085c1f7bda
3
+ metadata.gz: 4a7f5433094b30b366c592d1073bc92dd7b6e6d42545c7b3c5d33a2fbaac6f18
4
+ data.tar.gz: 6f1e071a3dda21deee16653b2e006085ea57ea6d2498fde0f41fa4acde4cc401
5
5
  SHA512:
6
- metadata.gz: 58ff92fdc52b1042178b74b69aec8eab6c2ddc0b3e91f978454988887c668ba8186e9c0b6d6fe9784ee7df4a4bb02b9c8754ebd64a4d54c5480815733f7793ee
7
- data.tar.gz: 8db27c55cbe778ce3d8f67581adcc3cb4b23b40336942bbfe7f9e05756ee8143ebe558b3c7e37da49fcf46a12bf43204fdf4d2f53bb38eded3db3e15ccfbdc91
6
+ metadata.gz: d8a6e4ea084637478ca26f05fec5d15cb765fc8f0646e8f97e9dc92f85cd57ef2eadabb72b120370da44a01c41b489191ad5db97188093ed10a08bbf7da25abd
7
+ data.tar.gz: 697d59776e3f6cf1a526c0f4c81f3b13ba20ac55fd8a38d97c778997cdfa9c629343bd601d14c9da87b77b00ba4ec872018ed2c51977bfa40a51a22053877367
@@ -0,0 +1,34 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+
21
+ strategy:
22
+ matrix:
23
+ ruby-version: ['3.2', '3.1', '3.0', '2.7']
24
+
25
+ steps:
26
+ - uses: actions/checkout@v3
27
+ - name: Set up Ruby ${{ matrix.ruby-version }}
28
+ uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby-version }}
31
+ - name: Install dependencies
32
+ run: bundle install
33
+ - name: Run tests
34
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v1.3.0
4
+
5
+ - Add Ruby 3.1 and 3.2 to CI
6
+ - Support translations keys without specified language #8
7
+
8
+ ## v1.2.0
9
+
10
+ - Support i18n 1.10.0
11
+ - Drop support for Ruby < 2.7
12
+
3
13
  ## v1.1.0
4
14
 
5
15
  - Remove upper bound on i18n dependency
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
-
5
- gem 'i18n', github: 'svenfuchs/i18n' if ENV['I18N_HEAD'] == '1'
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # i18n-backend-side\_by\_side
2
2
 
3
- [![Build Status](https://travis-ci.org/electric-feel/i18n-backend-side_by_side.svg)](https://travis-ci.org/electric-feel/i18n-backend-side_by_side)
3
+ [![Tests Status](https://github.com/electric-feel/i18n-backend-side_by_side/workflows/Ruby/badge.svg)](https://github.com/electric-feel/i18n-backend-side_by_side/actions?query=workflow%3ARuby)
4
4
  [![Gem Version](https://badge.fury.io/rb/i18n-backend-side_by_side.svg)](https://rubygems.org/gems/i18n-backend-side_by_side)
5
5
 
6
6
  **Tired of jumping between language files when translating keys? Stop jumping
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.3.0
@@ -16,9 +16,10 @@ Gem::Specification.new do |spec|
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ['lib']
19
- spec.required_ruby_version = '>= 2.0.0'
19
+ spec.required_ruby_version = '>= 2.7.0'
20
20
 
21
21
  spec.add_development_dependency 'rake'
22
22
  spec.add_development_dependency 'minitest'
23
- spec.add_dependency 'i18n', '>= 1.3.0'
23
+ spec.add_dependency 'i18n', '>= 1.10.0'
24
+ spec.add_dependency 'activesupport', '>= 6.0.0'
24
25
  end
@@ -1,10 +1,8 @@
1
1
  require 'i18n'
2
- require 'i18n/core_ext/hash'
2
+ require 'active_support/core_ext/hash/keys'
3
3
 
4
4
  module I18n
5
5
  module Backend
6
- using HashRefinements
7
-
8
6
  class SideBySide < Simple
9
7
  VERSION = File.read(File.expand_path('../../../../VERSION', __FILE__))
10
8
  LOCALE_PREFIX = '_'
@@ -14,13 +12,13 @@ module I18n
14
12
  def load_file(filename)
15
13
  type = File.extname(filename).tr('.', '').downcase
16
14
  raise UnknownFileType.new(type, filename) unless respond_to?(:"load_#{type}", true)
17
- data = send(:"load_#{type}", filename)
15
+ data = send(:"load_#{type}", filename).first
18
16
  unless data.is_a?(Hash)
19
17
  raise InvalidLocaleData.new(filename, 'expects it to return a hash, but does not')
20
18
  end
21
19
 
22
- if data.first.first == LOCALE_PREFIX
23
- _process([], data[LOCALE_PREFIX].deep_symbolize_keys)
20
+ if data.first.first.to_s == LOCALE_PREFIX
21
+ _process([], data.deep_symbolize_keys[LOCALE_PREFIX.to_sym])
24
22
  else
25
23
  data.each { |locale, d| store_translations(locale, d || {}) }
26
24
  end
@@ -29,7 +27,13 @@ module I18n
29
27
  private
30
28
 
31
29
  def _process(path, hash)
32
- if _contains_locales?(hash)
30
+ if !hash.is_a?(Hash)
31
+ ### TRANSLATION KEY WITHOUT SPECIFIED LANGUAGE - WILL BE APPLIED TO ALL LANGUAGES
32
+ value = hash
33
+ translations.keys.each do |locale|
34
+ _store([locale] + path, value)
35
+ end
36
+ elsif _contains_locales?(hash)
33
37
  hash.each do |locale, value|
34
38
  _store([_strip_locale_prefix(locale)] + path, value)
35
39
  end
@@ -19,3 +19,4 @@ _:
19
19
  only_en:
20
20
  some_key:
21
21
  _en: 'some value'
22
+ without_language: "Without Language"
data/test/test.rb CHANGED
@@ -32,4 +32,9 @@ class Test < Minitest::Test
32
32
  assert_raises { I18n.t('foo.only_en.some_key', locale: :de, raise: true) }
33
33
  assert_raises { I18n.t('foo.only_en', locale: :de, raise: true) }
34
34
  end
35
+
36
+ def test_without_language
37
+ assert_equal('Without Language', I18n.t('foo.without_language', language: :en))
38
+ assert_equal('Without Language', I18n.t('foo.without_language', language: :de))
39
+ end
35
40
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-backend-side_by_side
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipe Fatio
8
8
  - Pratik Mukerji
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-02-27 00:00:00.000000000 Z
12
+ date: 2023-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -45,14 +45,28 @@ dependencies:
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: 1.3.0
48
+ version: 1.10.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 1.3.0
55
+ version: 1.10.0
56
+ - !ruby/object:Gem::Dependency
57
+ name: activesupport
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 6.0.0
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 6.0.0
56
70
  description: Tired of jumping between language files when translating keys? Stop jumping
57
71
  and have all the languages side by side.
58
72
  email:
@@ -62,8 +76,8 @@ executables: []
62
76
  extensions: []
63
77
  extra_rdoc_files: []
64
78
  files:
79
+ - ".github/workflows/ruby.yml"
65
80
  - ".gitignore"
66
- - ".travis.yml"
67
81
  - CHANGELOG.md
68
82
  - Gemfile
69
83
  - LICENSE.txt
@@ -80,7 +94,7 @@ homepage: https://github.com/electric-feel/i18n-backend-side_by_side
80
94
  licenses:
81
95
  - MIT
82
96
  metadata: {}
83
- post_install_message:
97
+ post_install_message:
84
98
  rdoc_options: []
85
99
  require_paths:
86
100
  - lib
@@ -88,15 +102,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
102
  requirements:
89
103
  - - ">="
90
104
  - !ruby/object:Gem::Version
91
- version: 2.0.0
105
+ version: 2.7.0
92
106
  required_rubygems_version: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - ">="
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  requirements: []
98
- rubygems_version: 3.1.2
99
- signing_key:
112
+ rubygems_version: 3.3.10
113
+ signing_key:
100
114
  specification_version: 4
101
115
  summary: Tired of jumping between language files when translating keys? Stop jumping
102
116
  and have all the languages side by side.
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
- script: bundle exec rake test
5
- rvm:
6
- - 2.7.0
7
- env:
8
- - I18N_HEAD=0
9
- - I18N_HEAD=1
10
- matrix:
11
- allow_failures:
12
- - env: I18N_HEAD=1