remote_i18n_extension 1.0.6 → 1.0.7

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: 7ee6ebe7c84e8481b878680f6734c4e1d00f2a2c88e4f3ade034f9af1f32ab7a
4
- data.tar.gz: 9a7d832b0447637bdc001e52ba7ea082c6a5b700560acb277821cc2890e096c5
3
+ metadata.gz: b885cbc4c2a2e72f5522af0dafb7d4d1260be08a34553000f7d5efda6745be77
4
+ data.tar.gz: e282541fbf8c25af450710de61654fe0bd48998df3809757740ed2378af87105
5
5
  SHA512:
6
- metadata.gz: f3fbf84552b7fb258497b5182cd933554aa23af8f2266dac9ababefc05bcfb421b06bec1fcae34b1ec9f1e15fa704a13c89b062416fc21dd404ecb3b2fd14fc6
7
- data.tar.gz: b8586ffbd57127c7ac52b96f7b0628f89e7ea2284a5478ad8e0448f60b04ec0ee80920795c629c2c2fd076b485c22ca5e79ca9e68839883c0e3c196eeca0233a
6
+ metadata.gz: f8dca24fd803c98f25438d4a632d922571c782e21f1af26ed1704e83d7e4c2f299a5671f69d42d92ccfae0abe2c3384c051560427520d01075b3ce514d6432fa
7
+ data.tar.gz: 54a7b08beca98c561e14426451ba761347d00e8963e1915c56147d0be3addb16d112a449cd8b89e11c897ce1a598f94ed53ff814fe428a351e8baae4417113e2
@@ -4,9 +4,9 @@ RemoteI18nExtension.config do |config|
4
4
  # All the configurations are mandatory
5
5
 
6
6
  # URL to your remote locales folder housing all the translations
7
- # Please make sure the file structure inside this folder mirrors your local locales folder
8
- # for fallback
9
- # e.g. https://github.com/Gooner91/locales-repo/tree/master/locales
7
+ # Please make sure this folder mirrors your local locales folder
8
+ # to avoid fallbacks to local
9
+ # e.g. https://raw.githubusercontent.com/Gooner91/locales-repo/master/locales
10
10
  # config.remote_host = ENV['LOCALES_REMOTE_HOST']
11
11
 
12
12
 
@@ -20,6 +20,6 @@ RemoteI18nExtension.config do |config|
20
20
 
21
21
  # Paths to the translation files
22
22
  # Please make sure the paths to the translation files is same for local and remote locales folder
23
- # %w[locales/devise.de.yml locales/devise.en.yml ]
23
+ # e.g. Dir[Rails.root.join("config", "locales", "*.{rb,yml}")]
24
24
  # config.load_path = %w[]
25
25
  end
@@ -0,0 +1,15 @@
1
+ require 'i18n'
2
+ require_relative 'remote'
3
+
4
+ module RemoteI18nExtension
5
+ module Backend
6
+ class Initializer
7
+ def self.call
8
+ I18n.backend = I18n::Backend::Chain.new(
9
+ RemoteI18nExtension::Backend::Remote.new,
10
+ I18n::Backend::Simple.new
11
+ )
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module RemoteI18nExtension
2
- VERSION = '1.0.6'.freeze
2
+ VERSION = '1.0.7'.freeze
3
3
  end
@@ -1,33 +1,38 @@
1
1
  require 'i18n'
2
- require_relative 'remote_i18n_extension/backend/remote'
2
+ require_relative 'remote_i18n_extension/backend/initializer'
3
3
 
4
4
  module RemoteI18nExtension
5
- I18n.backend = I18n::Backend::Chain.new(
6
- RemoteI18nExtension::Backend::Remote.new,
7
- I18n::Backend::Simple.new
8
- )
5
+ RemoteI18nExtension::Backend::Initializer.call
9
6
 
10
7
  class << self
11
- attr_reader :load_path, :available_locales, :locale
12
8
  attr_accessor :remote_host
13
9
 
14
10
  def config
15
11
  yield self
16
12
  end
17
13
 
14
+ def available_locales=(locales_array)
15
+ I18n.available_locales = locales_array ? locales_array : [:en]
16
+ end
17
+
18
18
  def locale=(locale)
19
19
  I18n.locale = locale || :en
20
- @locale = I18n.locale
21
20
  end
22
21
 
23
22
  def load_path=(paths_array)
24
23
  I18n.load_path = paths_array
25
- @load_path = I18n.load_path
26
24
  end
27
25
 
28
- def available_locales=(locales_array)
29
- I18n.available_locales = locales_array ? locales_array : [:en]
30
- @available_locales = I18n.available_locales
26
+ def available_locales
27
+ I18n.available_locales
28
+ end
29
+
30
+ def locale
31
+ I18n.locale
32
+ end
33
+
34
+ def load_path
35
+ I18n.load_path
31
36
  end
32
37
 
33
38
  def translate(*args)
@@ -39,13 +44,4 @@ module RemoteI18nExtension
39
44
  I18n.reload!
40
45
  end
41
46
  end
42
-
43
- private
44
-
45
- def init_i18n_backend
46
- I18n.backend = I18n::Backend::Chain.new(
47
- RemoteI18nExtension::Backend::Remote.new,
48
- I18n::Backend::Simple.new
49
- )
50
- end
51
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_i18n_extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hassan Ahmed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-07 00:00:00.000000000 Z
11
+ date: 2023-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -94,6 +94,7 @@ files:
94
94
  - lib/generators/remote_i18n_extension/install_generator.rb
95
95
  - lib/generators/templates/remote_i18n_extension_config.rb
96
96
  - lib/remote_i18n_extension.rb
97
+ - lib/remote_i18n_extension/backend/initializer.rb
97
98
  - lib/remote_i18n_extension/backend/remote.rb
98
99
  - lib/remote_i18n_extension/version.rb
99
100
  - remote_i18n_extension.gemspec