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 +4 -4
- data/README.md +12 -8
- data/lib/localise_rails/config.rb +2 -1
- data/lib/localise_rails/seed_translations_to_request_store.rb +9 -0
- data/lib/localise_rails/version.rb +1 -1
- data/lib/localise_rails.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29e71c1a96ecf3717bb24d1b2fae43a7af6d94d67ef39986defa334cf293d407
|
4
|
+
data.tar.gz: 6da9977748eec495d7dec3d83c57e073cbbc0f4950a244af0f79116e10a2c385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
32
|
-
|
33
|
-
}
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
|
data/lib/localise_rails.rb
CHANGED
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
|
+
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-
|
11
|
+
date: 2022-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|