singleton-client-test 0.7.0.35 → 0.7.0.36
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf77c54658953532871e1efcaeefdd2eeafe82d79d45de57341bc1f36faef8c7
|
4
|
+
data.tar.gz: '031790359ed9af74295e1679aae41a486da96104ae3a02421494c1a6a3593fd4'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48113ab44d513f63789e7821340fc2de03e8f0c2a73063354ea7fc35b378b8d1f48b22ac3fc4d444c95a810e95a80cee02d8a44866153c82fa39300c1cf142ca
|
7
|
+
data.tar.gz: 05ba491346a1079a8d4b793d3d7d727aaec7ced066d7410df3b11e8a602700ba46a2fee5504649877db567ee5adaa492ab0bc0702925bad230bd6771b4aeb002
|
data/README.md
CHANGED
@@ -14,40 +14,40 @@ Basic Usage:
|
|
14
14
|
```ruby
|
15
15
|
require 'singleton-client'
|
16
16
|
|
17
|
-
|
18
|
-
result =
|
17
|
+
Sgtn.load_config(file, env)
|
18
|
+
result = Sgtn.translate(key, component, locale)
|
19
19
|
```
|
20
20
|
## API Usage
|
21
21
|
|
22
22
|
### Get a string's translation
|
23
|
-
`result =
|
23
|
+
`result = Sgtn.translate(key, component, locale)`
|
24
24
|
|
25
25
|
### Get a string's translation with default value when no translation
|
26
|
-
`result =
|
26
|
+
`result = Sgtn.translate(key, component, locale) { 'default value' }`
|
27
27
|
|
28
28
|
### Get a string's translation and format it with placeholders
|
29
|
-
`result =
|
29
|
+
`result = Sgtn.translate(key, component, locale, **args)`
|
30
30
|
|
31
31
|
### Get pluralized translation
|
32
|
-
`result =
|
32
|
+
`result = Sgtn.translate(key, component, locale, **args)`
|
33
33
|
|
34
34
|
### Get translations of a bundle
|
35
|
-
`result =
|
35
|
+
`result = Sgtn.get_translations(component, locale)`
|
36
36
|
|
37
37
|
### Set locale for a request
|
38
|
-
`
|
38
|
+
`Sgtn.locale = 'en'`
|
39
39
|
|
40
40
|
### Get locale of the request
|
41
|
-
`result =
|
41
|
+
`result = Sgtn.locale`
|
42
42
|
|
43
43
|
### Get a string's translation with locale set
|
44
44
|
```ruby
|
45
|
-
|
46
|
-
result =
|
45
|
+
Sgtn.locale = 'en'
|
46
|
+
result = Sgtn.translate(key, component)
|
47
47
|
```
|
48
48
|
|
49
49
|
### Get translations of a bundle with locale set
|
50
50
|
```ruby
|
51
|
-
|
52
|
-
result =
|
51
|
+
Sgtn.locale = 'en'
|
52
|
+
result = Sgtn.get_translations(component)
|
53
53
|
```
|
@@ -6,19 +6,19 @@ require 'request_store'
|
|
6
6
|
module SgtnClient
|
7
7
|
module Translation
|
8
8
|
module Implementation
|
9
|
-
# <b>DEPRECATED:</b> Please use <tt>
|
9
|
+
# <b>DEPRECATED:</b> Please use <tt>Sgtn:translate</tt> instead.
|
10
10
|
def getString(component, key, locale)
|
11
11
|
SgtnClient.logger.debug "[Translation.getString]component: #{component}, key: #{key}, locale: #{locale}"
|
12
12
|
translate(key, component, locale) { nil }
|
13
13
|
end
|
14
14
|
|
15
|
-
# <b>DEPRECATED:</b> Please use <tt>
|
15
|
+
# <b>DEPRECATED:</b> Please use <tt>Sgtn:translate</tt> instead.
|
16
16
|
def getString_p(component, key, plural_args, locale)
|
17
17
|
SgtnClient.logger.debug "[Translation][getString_p]component=#{component}, key=#{key}, locale=#{locale}"
|
18
18
|
translate(key, component, locale, **plural_args) { nil }
|
19
19
|
end
|
20
20
|
|
21
|
-
# <b>DEPRECATED:</b> Please use <tt>
|
21
|
+
# <b>DEPRECATED:</b> Please use <tt>Sgtn:translate</tt> instead.
|
22
22
|
def getString_f(component, key, args, locale, *_optionals)
|
23
23
|
SgtnClient.logger.debug "[Translation][getString_f]component=#{component}, key=#{key}, locale=#{locale}"
|
24
24
|
s = translate(key, component, locale) { nil }
|
@@ -34,7 +34,7 @@ module SgtnClient
|
|
34
34
|
s
|
35
35
|
end
|
36
36
|
|
37
|
-
# <b>DEPRECATED:</b> Please use <tt>
|
37
|
+
# <b>DEPRECATED:</b> Please use <tt>Sgtn:get_translations</tt> instead.
|
38
38
|
def getStrings(component, locale)
|
39
39
|
get_translations(component, locale)
|
40
40
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# SPDX-License-Identifier: EPL-2.0
|
3
3
|
|
4
4
|
String.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
5
|
+
# <b>DEPRECATED:</b> Please use <tt>Sgtn:translate</tt> instead.
|
5
6
|
def to_plural_s(locale, arg)
|
6
7
|
num_str = SgtnClient::Formatters::PluralFormatter.new(locale).num_s(self, arg)
|
7
8
|
if num_str.nil? || num_str.empty?
|
data/lib/singleton-client.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: singleton-client-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0.
|
4
|
+
version: 0.7.0.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VMware G11n Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|