singleton-client-test 0.7.0.34 → 0.7.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6722a7f77f8f9ee4fbf2f481d0c66e30b818c61746a9c7e8471fc1b225079f72
4
- data.tar.gz: ba0e6acade9bc655f97a731cf760e15097b713e99000cf8f2612e4975a357d2d
3
+ metadata.gz: f3e8238d56c7bd59283a05c0f30ee88385677bfd197c1f7320e82e6108f63d59
4
+ data.tar.gz: a3ff43a0f21730f0fda7e4862f2f523cdd35df110e541566bd267c08e1f3ed3d
5
5
  SHA512:
6
- metadata.gz: 27e3c13e20185a08049c2d634bc11e3a6d4e05095802e3c76026b74c34acd3a327b2e49c79020b9143479747e9d25fbfe5eaf4c859621afdc23f512859efd0fc
7
- data.tar.gz: bed85d6578397cd90e0823574f552d7f7e98e19a0f49e35e12963eecc32d5f87d85b8c0a8ab2c50c5c66b3ea81e630334194f8d4600fdc4a0eec2bf391b2decb
6
+ metadata.gz: 8209bba95fb8302ef10c6a09814b293ddfa5dd247fbb89061f4cf728ba29d0aa472834c5a5557cc65cff6a9d9020bcbe90c1204d8cd2a1698186e90496fb131e
7
+ data.tar.gz: 31ffc43ebb7ef7be54bee69b557f2e141ee7e8ad220588a707cb78c8972cfae8fcd3edafe0ceffc18f9ecbc61f77b73b9af319d3fbdecaf4712a1f6b581b524f
data/README.md CHANGED
@@ -1,54 +1,53 @@
1
- # Singeleton client for Ruby
1
+ # Singleton Client for Ruby
2
2
 
3
3
  ## Prerequisites
4
4
  - Ruby version: 3.0.0 or above
5
5
  - Bundler version: 2.2.3 or above
6
6
 
7
7
  ## Run Unit Test
8
- rake spec:unit
8
+ `rake spec`
9
9
 
10
10
  ## Usage
11
11
 
12
12
  Basic Usage:
13
13
 
14
14
  ```ruby
15
- require 'singleton-ruby'
16
-
17
- include SgtnClient
18
-
19
- SgtnClient.load(file, mode)
20
-
21
- SgtnClient::Source.loadBundles(locale)
22
-
23
- @Result = SgtnClient::Translation.getString(component, key, locale)
15
+ require 'singleton-client'
24
16
 
17
+ Singleton.load_config(file, env)
18
+ result = Singleton.translate(key, component, locale)
25
19
  ```
26
20
  ## API Usage
27
21
 
28
22
  ### Get a string's translation
29
- SgtnClient::Translation.getString(component, key, locale)
30
-
31
- ### Get a string's translation and format it with placeholders
32
- SgtnClient::Translation.getString_f(component, key, args, locale)
33
-
34
- ### Get a component's translations
35
- SgtnClient::Translation.getStrings(component, locale)
36
-
23
+ `result = Singleton.translate(key, component, locale)`
37
24
 
38
- ## API Usage(with request_store)
39
-
40
- Before call below APIs(without locale and component arguments), it requires to set the locale and component in the initial codes.
41
-
42
- ### Get a string's translation
43
- SgtnClient::T.s(key)
25
+ ### Get a string's translation with default value when no translation
26
+ `result = Singleton.translate(key, component, locale) { 'default value' }`
44
27
 
45
28
  ### Get a string's translation and format it with placeholders
46
- SgtnClient::T.s_f(key, args)
29
+ `result = Singleton.translate(key, component, locale, **args)`
47
30
 
48
- ### Get a component's translations
49
- SgtnClient::T.c()
31
+ ### Get pluralized translation
32
+ `result = Singleton.translate(key, component, locale, **args)`
50
33
 
34
+ ### Get translations of a bundle
35
+ `result = Singleton.get_translations(component, locale)`
51
36
 
37
+ ### Set locale for a request
38
+ `Singleton.locale = 'en'`
52
39
 
40
+ ### Get locale of the request
41
+ `result = Singleton.locale`
53
42
 
43
+ ### Get a string's translation with locale set
44
+ ```ruby
45
+ Singleton.locale = 'en'
46
+ result = Singleton.translate(key, component)
47
+ ```
54
48
 
49
+ ### Get translations of a bundle with locale set
50
+ ```ruby
51
+ Singleton.locale = 'en'
52
+ result = Singleton.get_translations(component)
53
+ ```
@@ -1,7 +1,7 @@
1
1
  # Copyright 2022 VMware, Inc.
2
2
  # SPDX-License-Identifier: EPL-2.0
3
3
 
4
- require 'multi_json'
4
+ require 'json'
5
5
 
6
6
  module SgtnClient
7
7
  module Common
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.34
4
+ version: 0.7.0.35
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-04-27 00:00:00.000000000 Z
11
+ date: 2022-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc