singleton-client-test 0.7.0.26 → 0.7.0.27

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: 6a0d174f65d5ce5b87ead4f4c61bc57070bc051ab51bc65343c7ca50a0fd0b68
4
- data.tar.gz: eaf356bee612ecf0f512083e029964de5307acd3dc05555c710ce386384346ea
3
+ metadata.gz: '0989ae16ca4fcfd6088931a367ac5eb671fd8e087a8d9e32539a2480d1107b34'
4
+ data.tar.gz: d750961a5b1c116914f50a947626e0fc4e8a391b3fa28b8e2a77e3651c823ba2
5
5
  SHA512:
6
- metadata.gz: 512573410bae6caa91cf0b893f27e95a0864a0374e75bd601a55a2f471ca75ed69c6f537aeb24ca7b9202a6bc59c231a838c3d5a167fdc56f130c8ab844a32e5
7
- data.tar.gz: 6a2f2f82f806b564ede5218c7cda2123e528515f5089bb4ea3658451598174d140006e9d075ed68e4b1ae3c04b78b4dc3892a00bc26e447387edb282a8f35c9b
6
+ metadata.gz: 89e893c6f79dde564732300a4431581effb0dc6aeb7eb3f8fc665c8108d4eaf0292a64e962da259f931c9ebf21299ae05d0db4cac427ec78c5a50c3c81d9a562
7
+ data.tar.gz: fd50009cbda5e06c8e1a3d7f81ec02c6b1d060fec95d6824b8e8713f33c48acad660be1e276ee565403cc8eda5abcf9d8f6f0faa936b895ceb9cef29feec0dbd
@@ -42,16 +42,7 @@ module SgtnClient
42
42
  end
43
43
 
44
44
  def self.getStrings(component, locale)
45
- flocale = SgtnClient::LocaleUtil.fallback(locale)
46
- cache_key = SgtnClient::CacheUtil.get_cachekey(component, flocale)
47
- items = SgtnClient::CacheUtil.get_cache(cache_key)
48
- if items.nil?
49
- items = getTranslations(component, flocale)
50
- SgtnClient::CacheUtil.write_cache(cache_key, items)
51
- else
52
- SgtnClient.logger.debug "Getting translations from cache with key: " + cache_key
53
- end
54
-
45
+ items = get_cs(component, locale)
55
46
  default = SgtnClient::Config.configurations.default
56
47
  if items.nil? || items["messages"] == nil
57
48
  items = {}
@@ -68,11 +59,20 @@ module SgtnClient
68
59
  private
69
60
 
70
61
  def self.getTranslation(component, key, locale)
62
+ items = get_cs(component, locale)
63
+ if items.nil? || items["messages"] == nil
64
+ nil
65
+ else
66
+ items["messages"][key]
67
+ end
68
+ end
69
+
70
+ def self.get_cs(component, locale)
71
71
  flocale = SgtnClient::LocaleUtil.fallback(locale)
72
72
  cache_key = SgtnClient::CacheUtil.get_cachekey(component, flocale)
73
73
  items = SgtnClient::CacheUtil.get_cache(cache_key)
74
74
  if items.nil?
75
- items = getTranslations(component, flocale)
75
+ items = load(component, flocale)
76
76
  if items.nil?
77
77
  items = SgtnClient::Source.getSources(component, SgtnClient::Config.configurations.default)
78
78
  SgtnClient::Core::Cache.put(cache_key, items, 60)
@@ -82,24 +82,21 @@ module SgtnClient
82
82
  else
83
83
  SgtnClient.logger.debug "Getting translations from cache with key: " + cache_key
84
84
  end
85
- if items.nil? || items["messages"] == nil
86
- nil
87
- else
88
- items["messages"][key]
89
- end
90
- end
91
-
92
- def self.getTranslations(component, locale)
85
+
86
+ return items
87
+ end
88
+
89
+ def self.load(component, locale)
93
90
  env = SgtnClient::Config.default_environment
94
91
  mode = SgtnClient::Config.configurations[env]["bundle_mode"]
95
92
  if mode == 'offline'
96
- return get_offbundle(component, locale)
93
+ return load_o(component, locale)
97
94
  else
98
- return get_server(component, locale)
95
+ return load_s(component, locale)
99
96
  end
100
97
  end
101
98
 
102
- def self.get_offbundle(component, locale)
99
+ def self.load_o(component, locale)
103
100
  env = SgtnClient::Config.default_environment
104
101
  product_name = SgtnClient::Config.configurations[env]["product_name"]
105
102
  version = SgtnClient::Config.configurations[env]["version"].to_s
@@ -109,7 +106,7 @@ module SgtnClient
109
106
  SgtnClient::FileUtil.read_json(bundlepath)
110
107
  end
111
108
 
112
- def self.get_server(component, locale)
109
+ def self.load_s(component, locale)
113
110
  env = SgtnClient::Config.default_environment
114
111
  product_name = SgtnClient::Config.configurations[env]["product_name"]
115
112
  vip_server = SgtnClient::Config.configurations[env]["vip_server"]
@@ -40,7 +40,7 @@ module SgtnClient
40
40
  :rest_endpoint, :rest_token_endpoint, :client_id, :client_secret,
41
41
  :openid_endpoint, :openid_redirect_uri, :openid_client_id, :openid_client_secret,
42
42
  :verbose_logging, :product_name, :version, :vip_server, :bundle_mode,
43
- :translation_bundle, :source_bundle, :cache_expiry_period, :disable_cache
43
+ :translation_bundle, :source_bundle, :cache_expiry_period, :disable_cache, :default_language
44
44
 
45
45
 
46
46
  # Create Config object
@@ -32,7 +32,12 @@ module SgtnClient
32
32
  env = SgtnClient::Config.default_environment
33
33
  product_name = SgtnClient::Config.configurations[env]["product_name"]
34
34
  version = SgtnClient::Config.configurations[env]["version"].to_s
35
- return product_name + "_" + version + "_" + component + "_" + locale
35
+ default_l = SgtnClient::Config.configurations[env]["default_language"]
36
+ if default_l == nil
37
+ default_l = 'en'
38
+ end
39
+ lc = locale == default_l ? SgtnClient::Config.configurations.default: locale
40
+ return product_name + "_" + version + "_" + component + "_" + lc
36
41
  end
37
42
  end
38
43
 
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.26
4
+ version: 0.7.0.27
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-01-25 00:00:00.000000000 Z
11
+ date: 2022-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client