localise_rails 0.1.4 → 0.1.5

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: 5ebf55a8896bc12f139cef5deb60c4ebd092c4d5c339dc34011905b1f852cf7f
4
- data.tar.gz: f65f012e3a2c54f4c321fd50792c0e346160d7596fc9bb0bfb08794247c3e8f6
3
+ metadata.gz: 29e71c1a96ecf3717bb24d1b2fae43a7af6d94d67ef39986defa334cf293d407
4
+ data.tar.gz: 6da9977748eec495d7dec3d83c57e073cbbc0f4950a244af0f79116e10a2c385
5
5
  SHA512:
6
- metadata.gz: 5664fb9e435ae1a52a79d71228751514bafbaf421109882c6c892ff475a21ef6016db1b7da98a19a5422d1495bea17211a997a7890a218734df0e2907334f2ed
7
- data.tar.gz: 86507ff64de2f9999be362690bb684dbbbb3ae822d6ca69385d955d4c9d753eb2f4391cbf24b494fe4655e9a4d3f0a9b0012f8b0cc4dc8d284ffadd871832627
6
+ metadata.gz: 172fd72386244d19ea9b8134ef9ed53c61dfc55277bfab22d9ac20a0aafb17d2b5d6fcc744b349455230b2dc19b3dddbd0049e87eb22e2a66edc1031843ab56d
7
+ data.tar.gz: b226e02cd9f4cfcc94a38c65d521e4fcaac58e2f3ddfcc3f98c628d69750c0861395deb072a39097aef4a6f63e42d677d214d7dd844ce42197f834455ee3db25
data/README.md CHANGED
@@ -27,14 +27,18 @@ LocaliseRails.configure do |config|
27
27
  config.api_key = "LOCALISE_KEY"
28
28
 
29
29
  ### all options https://localise.biz/api/docs/export/exportall
30
- config.options = {
31
- filter: 'backend',
32
- fallback: 'en-US'
33
- }
34
-
35
- config.rename_locales = {
36
- 'en-US' => 'en'
37
- }
30
+ # config.options = {
31
+ # filter: 'backend',
32
+ # fallback: 'en-US'
33
+ # }
34
+
35
+ ### rename locales from localise
36
+ # config.rename_locales = {
37
+ # 'en-US' => 'en'
38
+ # }
39
+
40
+ ### set prefix for locales
41
+ # config.prefix = 'localise'
38
42
 
39
43
  ### all options https://github.com/redis/redis-rb
40
44
  # config.redis_options = {
@@ -1,12 +1,13 @@
1
1
  module LocaliseRails
2
2
  # Class used to initialize configuration object.
3
3
  class Config
4
- attr_accessor :api_key, :options, :redis_options, :redis, :rename_locales
4
+ attr_accessor :api_key, :options, :redis_options, :redis, :rename_locales, :prefix
5
5
 
6
6
  def initialize
7
7
  @options = {}
8
8
  @rename_locales = {}
9
9
  @redis_options = {}
10
+ @prefix = nil
10
11
  end
11
12
  end
12
13
  end
@@ -24,9 +24,18 @@ module LocaliseRails
24
24
  end
25
25
 
26
26
  def prepare_locales(locales)
27
+ # Rename locales
27
28
  LocaliseRails.config.rename_locales.each do |old_key, new_key|
28
29
  locales[new_key] = locales.delete old_key if locales[old_key]
29
30
  end
31
+
32
+ # Set prefix
33
+ if LocaliseRails.config.prefix
34
+ locales.each do |lang, translations|
35
+ locales[lang] = { LocaliseRails.config.prefix => translations }
36
+ end
37
+ end
38
+
30
39
  locales
31
40
  end
32
41
 
@@ -1,3 +1,3 @@
1
1
  module LocaliseRails
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
@@ -42,6 +42,10 @@ module LocaliseRails
42
42
  # 'en-US' => 'en'
43
43
  # }
44
44
  #
45
+ #
46
+ # # set prefix for locales
47
+ # # config.prefix = 'localise'
48
+ #
45
49
  # # all options https://github.com/redis/redis-rb
46
50
  # # config.redis_options = {
47
51
  # # host: "127.0.0.1",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localise_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Osman Baliev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-25 00:00:00.000000000 Z
11
+ date: 2022-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler