remote-I18n-extension-hcc 1.0.0 → 1.0.2

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: c4a338512aeedd7365f3a242889e32be1adaa60f691992d502ca0ab439c05f0d
4
- data.tar.gz: 7014e16f97361cf85546799619f2dc8b928423984db8f8fc747ee920781ee161
3
+ metadata.gz: cbf4d063b580df04d004612e9e5de4dfab6acf2108736859b7c190a051e60fbd
4
+ data.tar.gz: bbff9ac4061e5e56f2848e008e5682879c63eae9534a950c02397784e047d9a6
5
5
  SHA512:
6
- metadata.gz: 79022619af5a2c95f56df231334615438b5abcebc8afe0006c9bf130ccd5a456fe8f234c1b1d5d58fd07e888540f82340b7b72d48326b346852cb79f5ae175cb
7
- data.tar.gz: 1a88e35b3e1646c060020d54f7f9cc2ca1190cb2197ebe0d52c3b5dc13e017b6f9eb2a8f3a7222f69a8ef416408fba6dee54198763490998286f956b8f0c1021
6
+ metadata.gz: c2064581959c280b70af4d12b5a710a0388d9fdf7572dab3c5e76dfd939bc5ccf7957af4fb6272ed44c551fa0258b8a8ef85f80ed447ff87f66e77c7deb9776e
7
+ data.tar.gz: 4376bbf44d45c039f37a6a673b0e1593bd7d73e0d71f5f76f2f4952295569d17faa1c05a1b3ff8a4ae7f06b18f2519314415614a608998354c7657cac74f5b25
@@ -0,0 +1,15 @@
1
+ require 'rails/generators'
2
+
3
+ module Generators
4
+ module RemoteI18nExtensionHcc
5
+ class InstallGenerator < Rails::Generator::Base
6
+ source_root File.expand_path('../templates', __dir__)
7
+
8
+ desc 'Creates config file for RemoteI18nExtensionHcc'
9
+
10
+ def copy_config
11
+ template 'remote-I18n-extension-hcc-config.rb', "#{Rails.root}/config/remote-I18n-extension-hcc.rb"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,25 @@
1
+ require 'remote-I18n-extension-hcc-config'
2
+
3
+ RemoteI18nExtensionHcc.config do |config|
4
+ # All the configurations are mandatory
5
+
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
10
+ # config.remote_host = ENV['LOCALES_REMOTE_HOST']
11
+
12
+
13
+ # Below configurations are for the ruby I18n module
14
+
15
+ # List of available locales
16
+ # config.available_locales = [:en, :de]
17
+
18
+
19
+ # config.locale = :en
20
+
21
+ # Paths to the translation files
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 ]
24
+ # config.load_path = %w[]
25
+ end
@@ -1,3 +1,3 @@
1
1
  module RemoteI18nExtensionHcc
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.2'.freeze
3
3
  end
@@ -1,5 +1,12 @@
1
1
  require 'i18n'
2
+ require_relative 'remote-I18n-extension-hcc/backend/remote'
3
+
2
4
  module RemoteI18nExtensionHcc
5
+ I18n.backend = I18n::Backend::Chain.new(
6
+ RemoteI18nExtensionHcc::Backend::Remote.new,
7
+ I18n::Backend::Simple.new
8
+ )
9
+
3
10
  class << self
4
11
  attr_reader :load_path, :available_locales, :locale
5
12
  attr_accessor :remote_host
@@ -19,5 +26,19 @@ module RemoteI18nExtensionHcc
19
26
  def available_locales=(locales_array)
20
27
  I18n.available_locales = locales_array ? locales_array : [:en]
21
28
  end
29
+
30
+ def translate(*args)
31
+ I18n.t(*args)
32
+ end
33
+ alias :t :translate
34
+ end
35
+
36
+ private
37
+
38
+ def init_i18n_backend
39
+ I18n.backend = I18n::Backend::Chain.new(
40
+ RemoteI18nExtensionHcc::Backend::Remote.new,
41
+ I18n::Backend::Simple.new
42
+ )
22
43
  end
23
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote-I18n-extension-hcc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hassan Ahmed
@@ -91,6 +91,8 @@ files:
91
91
  - Gemfile
92
92
  - README.md
93
93
  - Rakefile
94
+ - lib/generators/remote-I18n-extension-hcc/install_generator.rb
95
+ - lib/generators/templates/remote-I18n-extension-hcc-config.rb
94
96
  - lib/remote-I18n-extension-hcc.rb
95
97
  - lib/remote-I18n-extension-hcc/backend/remote.rb
96
98
  - lib/remote-I18n-extension-hcc/version.rb