remote_i18n_extension 1.0.5 → 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: caf558e764733150d19694d3e9644afc529c25ff23cb78bc7dca6325a0f8e6fb
4
- data.tar.gz: d0ea4669e51805197125a9aa367ac67544665c6e73fe8efb770590c5f4df1238
3
+ metadata.gz: b885cbc4c2a2e72f5522af0dafb7d4d1260be08a34553000f7d5efda6745be77
4
+ data.tar.gz: e282541fbf8c25af450710de61654fe0bd48998df3809757740ed2378af87105
5
5
  SHA512:
6
- metadata.gz: 2bfa441c16ac010625a1e214ffc6c2a17e445f16fbff0ee113827a4ac655b78dda09f296e7ce351fd896c0c37ee884401776801003575b427e59ead0bd700b74
7
- data.tar.gz: 4c2fe33d99cf449cea068f031854869afd80b1973a88fb869ff8a1347ed0734de41eb744fd80ed91ec6e8d21e0d64e4d04af16c031f4e4c2e802e125937a2b1d
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.5'.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
- I18n.load_path += paths_array
25
- @load_path = I18n.load_path
23
+ I18n.load_path = paths_array
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.5
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