singleton-ruby 0.0.9 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -0
  3. data/lib/sgtn-client/api/source.rb +18 -5
  4. data/lib/sgtn-client/api/translation.rb +36 -6
  5. data/lib/sgtn-client/core/config.rb +0 -7
  6. data/lib/sgtn-client/core/exceptions.rb +1 -1
  7. data/lib/sgtn-client/sgtn-client.rb +1 -0
  8. data/lib/sgtn-client/util/cache-util.rb +4 -0
  9. data/lib/sgtn-client/util/locale-util.rb +31 -0
  10. data/lib/version.rb +1 -1
  11. data/spec/config/locales/default/JAVA/default.yml +5 -0
  12. data/spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_de.json +8 -0
  13. data/spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_en.json +8 -0
  14. data/spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_latest.json +8 -0
  15. data/spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_zh-Hans.json +8 -0
  16. data/spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_zh-Hant.json +8 -0
  17. data/spec/config/locales/l10n/bundles/{logInsight → test}/4.8.1/creation.json +0 -0
  18. data/spec/config/locales/l10n/bundles/{logInsight → test}/4.8.1/version.json +0 -0
  19. data/spec/config/sgtnclient-invalidate.yml +3 -7
  20. data/spec/config/sgtnclient.yml +3 -7
  21. data/spec/spec_helper.rb +1 -8
  22. data/spec/unit/cache_spec.rb +5 -6
  23. data/spec/unit/locale_spec.rb +23 -0
  24. data/spec/unit/offclient_spec.rb +29 -7
  25. data/spec/unit/onclient_spec.rb +32 -0
  26. metadata +28 -45
  27. data/lib/generators/sgtnclient/USAGE +0 -3
  28. data/lib/generators/sgtnclient/install_generator.rb +0 -15
  29. data/lib/generators/sgtnclient/templates/sgtnclient.rb +0 -2
  30. data/lib/generators/sgtnclient/templates/sgtnclient.yml +0 -33
  31. data/spec/config/locales/default/JAVA/en.yml +0 -2
  32. data/spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_de.json +0 -11
  33. data/spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_en.json +0 -12
  34. data/spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_latest.json +0 -11
  35. data/spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hans.json +0 -11
  36. data/spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hant.json +0 -11
  37. data/spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh_CN.json +0 -11
  38. data/spec/unit/restclient_spec.rb +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2e9bf60e2c6e5a1c59e1d0b25a9acb3d7f645c08aab5365d725895bd5a0c5f0
4
- data.tar.gz: 54d2803ac84376f0df6223d9aa3d4eb1a553f8b93214acc1591c95566de5346d
3
+ metadata.gz: c2e092b1d69a9639d976877f5ad64486ebe37a6d64bdaef84f1aa10a1424ae6e
4
+ data.tar.gz: 42f5c443bf2e9a20004ba147586de5088d9fdb1a7cd56b422f0b8fff85ea82ec
5
5
  SHA512:
6
- metadata.gz: 1e8775d0142dddcfef46c2ba781ed0885f16854fccab273f2483f1fbd0e6744cc1a360d569f3e32c92acc40ebd001864c45448eeaa70443095952a81eab79b2d
7
- data.tar.gz: 3b009b345f63e0c97fcbe983b15673ea82199264fef1135ac3e0922677bf07fd1695ba5c011ad5932730266cb08228dccb5d5ff68670289df80ae98f146a13cd
6
+ metadata.gz: 4e269b9d4dc398a51491bcaa8c71304c360cc082cce8bc6f49ca07ddd7d72849f26341d65d1700e452eb5976197eb5a95542f09e9bf1aa595e2448becd894353
7
+ data.tar.gz: d8230f6464e7c1c4f940665f55bfb0fdb577553c980b844ecd45803e77ee3ca4ffdf346c67deec784daf17d94fc2bd2cbbdf2ed8e4b9eb565f24a12d3191f788
data/README.md CHANGED
@@ -7,5 +7,31 @@
7
7
  ## Run Unit Test
8
8
  rake spec:unit
9
9
 
10
+ ## Usage
11
+
12
+ Basic Usage:
13
+
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)
24
+
25
+ ```
26
+ ## API
27
+
28
+ ### 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
+
35
+
10
36
 
11
37
 
@@ -7,12 +7,11 @@ module SgtnClient
7
7
 
8
8
  class Source
9
9
 
10
- def self.getSource(component, key)
11
- locale = "en"
10
+ def self.getSource(component, key, locale)
12
11
  cache_key = SgtnClient::CacheUtil.get_cachekey(component, locale)
13
12
  items = SgtnClient::CacheUtil.get_cache(cache_key)
14
13
  if items.nil?
15
- items = getBundle(component)
14
+ items = getBundle(component, locale)
16
15
  SgtnClient.logger.debug "Putting sources items into cache with key: " + cache_key
17
16
  SgtnClient::CacheUtil.write_cache(cache_key, items)
18
17
  else
@@ -25,8 +24,22 @@ module SgtnClient
25
24
  return str
26
25
  end
27
26
 
27
+ def self.getSources(component, locale)
28
+ cache_key = SgtnClient::CacheUtil.get_cachekey(component, locale)
29
+ items = SgtnClient::CacheUtil.get_cache(cache_key)
30
+ if items.nil?
31
+ items = getBundle(component, locale)
32
+ SgtnClient.logger.debug "Putting sources items into cache with key: " + cache_key
33
+ SgtnClient::CacheUtil.write_cache(cache_key, items)
34
+ else
35
+ SgtnClient.logger.debug "Getting sources from cache with key: " + cache_key
36
+ end
37
+ return items
38
+ end
39
+
28
40
  def self.loadBundles(locale)
29
41
  env = SgtnClient::Config.default_environment
42
+ SgtnClient::Config.configurations.default = locale
30
43
  source_bundle = SgtnClient::Config.configurations[env]["source_bundle"]
31
44
  SgtnClient.logger.debug "Loading [" + locale + "] bundles from path: " + source_bundle
32
45
  Dir.children(source_bundle).each do |component|
@@ -40,10 +53,10 @@ module SgtnClient
40
53
 
41
54
  private
42
55
 
43
- def self.getBundle(component)
56
+ def self.getBundle(component, locale)
44
57
  env = SgtnClient::Config.default_environment
45
58
  source_bundle = SgtnClient::Config.configurations[env]["source_bundle"]
46
- bundlepath = source_bundle + "/" + component + "/en.yml"
59
+ bundlepath = source_bundle + "/" + component + "/" + locale + ".yml"
47
60
  SgtnClient.logger.debug "Getting source from bundle: " + bundlepath
48
61
  begin
49
62
  bundle = read_yml(bundlepath)
@@ -6,32 +6,61 @@ module SgtnClient
6
6
  autoload :Request, "sgtn-client/core/request"
7
7
  autoload :Cache, "sgtn-client/core/cache"
8
8
  autoload :CacheUtil, "sgtn-client/util/cache-util"
9
+ autoload :LocaleUtil, "sgtn-client/util/locale-util"
9
10
  end
10
11
 
11
12
  class Translation
12
13
 
13
14
  def self.getString(component, key, locale)
14
- cache_key = SgtnClient::CacheUtil.get_cachekey(component, locale)
15
+ flocale = SgtnClient::LocaleUtil.fallback(locale)
16
+ cache_key = SgtnClient::CacheUtil.get_cachekey(component, flocale)
15
17
  items = SgtnClient::CacheUtil.get_cache(cache_key)
16
18
  if items.nil?
17
- items = getTranslations(component, locale)
19
+ items = getTranslations(component, flocale)
18
20
  SgtnClient::CacheUtil.write_cache(cache_key, items)
19
21
  else
20
22
  SgtnClient.logger.debug "Getting translations from cache with key: " + cache_key
21
23
  end
22
- if items.nil?
23
- return SgtnClient::Source.getSource(component, key)
24
- end
25
24
 
25
+ default = SgtnClient::Config.configurations.default
26
+ if items.nil? || items["messages"] == nil
27
+ return SgtnClient::Source.getSource(component, key, default)
28
+ end
26
29
  str = items["messages"][key]
27
30
  if str.nil?
28
- return SgtnClient::Source.getSource(component, key)
31
+ return SgtnClient::Source.getSource(component, key, default)
29
32
  else
30
33
  return str
31
34
  end
35
+ end
32
36
 
37
+ def self.getString_f(component, key, args, locale)
38
+ s = getString(component, key, locale)
39
+ puts 1111
40
+ puts SgtnClient::Config.configurations.default
41
+ puts s
42
+ return s % args
33
43
  end
34
44
 
45
+ def self.getStrings(component, locale)
46
+ flocale = SgtnClient::LocaleUtil.fallback(locale)
47
+ cache_key = SgtnClient::CacheUtil.get_cachekey(component, flocale)
48
+ items = SgtnClient::CacheUtil.get_cache(cache_key)
49
+ if items.nil?
50
+ items = getTranslations(component, flocale)
51
+ SgtnClient::CacheUtil.write_cache(cache_key, items)
52
+ else
53
+ SgtnClient.logger.debug "Getting translations from cache with key: " + cache_key
54
+ end
55
+
56
+ default = SgtnClient::Config.configurations.default
57
+ if items.nil? || items["messages"] == nil
58
+ items = SgtnClient::Source.getSources(component, default)
59
+ end
60
+ return items
61
+ end
62
+
63
+
35
64
  private
36
65
 
37
66
  def self.getTranslations(component, locale)
@@ -67,6 +96,7 @@ module SgtnClient
67
96
  SgtnClient.logger.debug "Getting translations from server: " + vip_server
68
97
  version = SgtnClient::Config.configurations[env]["version"].to_s
69
98
  url = vip_server + "/i18n/api/v2/translation/products/" + product_name + "/versions/" + version + "/locales/" + locale + "/components/" + component+ "?checkTranslationStatus=false&machineTranslation=false&pseudo=false"
99
+ SgtnClient.logger.debug url
70
100
  begin
71
101
  obj = SgtnClient::Core::Request.get(url)
72
102
  rescue => exception
@@ -65,13 +65,6 @@ module SgtnClient
65
65
  class << self
66
66
 
67
67
  @@config_cache = {}
68
-
69
- # Load configurations from file
70
- # === Arguments
71
- # * <tt>file_name</tt> -- Configuration file path
72
- # * <tt>default_environment</tt> (Optional) -- default environment configuration to load
73
- # === Example
74
- # Config.load('config/paypal.yml', 'development')
75
68
  def load(file_name, default_env = default_environment)
76
69
  @@config_cache = {}
77
70
  @@configurations = read_configurations(file_name)
@@ -14,7 +14,7 @@ module SgtnClient
14
14
  def to_s
15
15
  begin
16
16
  response_body = JSON.parse(response.body)
17
- debug_id = response["paypal-debug-id"]
17
+ debug_id = response["sgtn-debug-id"]
18
18
  debug_id = response["correlation-id"] if debug_id.to_s == ''
19
19
  debug_id = response_body["debug_id"] if debug_id.to_s == ''
20
20
  rescue
@@ -9,6 +9,7 @@ module SgtnClient
9
9
  autoload :Logging, "sgtn-client/core/logging"
10
10
  autoload :Exceptions, "sgtn-client/core/exceptions"
11
11
  autoload :ValidateUtil, "sgtn-client/util/validate-util"
12
+ autoload :LocaleUtil, "sgtn-client/util/locale-util"
12
13
 
13
14
  class << self
14
15
  def configure(options = {}, &block)
@@ -14,6 +14,10 @@ module SgtnClient
14
14
  return items
15
15
  end
16
16
 
17
+ def self.clear_cache()
18
+ SgtnClient::Core::Cache.clear()
19
+ end
20
+
17
21
  def self.write_cache(cache_key, items)
18
22
  env = SgtnClient::Config.default_environment
19
23
  cache_expiry_period = SgtnClient::Config.configurations[env]["cache_expiry_period"]
@@ -0,0 +1,31 @@
1
+ module SgtnClient
2
+
3
+ DEFAULT_LOCALES = ['en', 'de', 'es', 'fr', 'ko', 'ja', 'zh-Hans', 'zh-Hant']
4
+
5
+ MAP_LOCALES = {
6
+ "zh-CN" =>"zh-Hans",
7
+ "zh-TW" =>"zh-Hant",
8
+ "zh-Hans-CN" =>"zh-Hans",
9
+ "zh-Hant-TW" =>"zh-Hant",
10
+ }
11
+
12
+ class LocaleUtil
13
+ def self.fallback(locale)
14
+ found = SgtnClient::DEFAULT_LOCALES.select {|e| e == locale}
15
+ if !found.empty?
16
+ return found[0]
17
+ end
18
+ if SgtnClient::MAP_LOCALES.key?(locale)
19
+ return SgtnClient::MAP_LOCALES[locale]
20
+ end
21
+ parts = locale.split("-")
22
+ if parts.size > 1
23
+ f = SgtnClient::DEFAULT_LOCALES.select {|e| e == parts[0]}
24
+ if !f.empty?
25
+ return f[0]
26
+ end
27
+ end
28
+ return locale
29
+ end
30
+ end
31
+ end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
 
2
- VERSION_INFO = [0, 0, 9].freeze
2
+ VERSION_INFO = [0, 1, 3].freeze
3
3
  VERSION = VERSION_INFO.map(&:to_s).join('.').freeze
@@ -0,0 +1,5 @@
1
+ default:
2
+ helloworld: "Hello world"
3
+ hello: "Hello"
4
+ welcome: "%s, welcome login %s!"
5
+ login: "%s login %s!"
@@ -0,0 +1,8 @@
1
+ {
2
+ "component" : "JAVA",
3
+ "messages" : {
4
+ "helloworld" : "Hallo Welt",
5
+ "welcome": "%s, Willkommen in der %s des Logins!!"
6
+ },
7
+ "locale" : "de"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "component" : "JAVA",
3
+ "messages" : {
4
+ "helloworld" : "Hello world",
5
+ "welcome": "%s, welcome login %s!"
6
+ },
7
+ "locale" : "en"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "component" : "JAVA",
3
+ "messages" : {
4
+ "helloworld" : "Hello world",
5
+ "welcome": "%s, welcome login %s!"
6
+ },
7
+ "locale" : "latest"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "component" : "JAVA",
3
+ "messages" : {
4
+ "helloworld" : "你好世界",
5
+ "welcome": "%s,欢迎登录%s!"
6
+ },
7
+ "locale" : "zh-Hans"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "component" : "JAVA",
3
+ "messages" : {
4
+ "helloworld" : "你好,世界",
5
+ "welcome": "%s,歡迎登錄%s!"
6
+ },
7
+ "locale" : "zh-Hant"
8
+ }
@@ -1,9 +1,5 @@
1
1
  test: &default
2
2
 
3
- # Credentials for REST APIs
4
- client_id: tee
5
- client_secret: 89987
6
-
7
3
  # Mode can be 'live' or 'sandbox'
8
4
  mode: sandbox1
9
5
 
@@ -14,16 +10,16 @@ test: &default
14
10
  signature: sfds-RWy
15
11
  # # With Certificate
16
12
  # cert_path: "config/cert_key.pem"
17
- sandbox_email_address: linr@vmware.com
13
+ sandbox_email_address: linr@aa.com
18
14
 
19
15
  # #Product Name
20
- product_name: logInsight
16
+ product_name: test
21
17
 
22
18
  # # bundle version
23
19
  version: 4.8
24
20
 
25
21
  # # HTTP Proxy
26
- vip_server: https://g11n-vip-dev-1.eng.vmware.com:8090
22
+ vip_server: https://server:8090
27
23
 
28
24
  # # mode of bundle: online/offline
29
25
  bundle_mode: offline1www
@@ -1,9 +1,5 @@
1
1
  test: &default
2
2
 
3
- # Credentials for REST APIs
4
- client_id: tee
5
- client_secret: 89987
6
-
7
3
  # Mode can be 'live' or 'sandbox'
8
4
  mode: sandbox
9
5
 
@@ -14,16 +10,16 @@ test: &default
14
10
  signature: sfds-RWy
15
11
  # # With Certificate
16
12
  # cert_path: "config/cert_key.pem"
17
- sandbox_email_address: linr@vmware.com
13
+ sandbox_email_address: linr@aa.com
18
14
 
19
15
  # #Product Name
20
- product_name: logInsight
16
+ product_name: test
21
17
 
22
18
  # # bundle version
23
19
  version: 4.8.1
24
20
 
25
21
  # # HTTP Proxy
26
- vip_server: https://g11n-vip-dev-1.eng.vmware.com:8090
22
+ vip_server: https://server:8090
27
23
 
28
24
  # # mode of bundle: online/offline
29
25
  bundle_mode: offline
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'bundler/setup'
2
2
  require_relative '../lib/sgtn-client/sgtn-client.rb'
3
- require 'twitter_cldr'
3
+ require 'logger'
4
4
 
5
5
  if ENV['COVERAGE']
6
6
  require 'simplecov'
@@ -12,29 +12,22 @@ if ENV['COVERAGE']
12
12
  end
13
13
 
14
14
  Bundler.require :default, :test
15
- #SgtnClient.load("./spec/config/sgtnclient.yml", "test")
16
-
17
- #require 'SgtnClient'
18
15
 
19
16
  include SgtnClient
20
17
  include SgtnClient::Logging
21
18
  include SgtnClient::Exceptions
22
19
 
23
- require 'logger'
24
-
25
20
  SgtnClient.load("./spec/config/sgtnclient.yml", "test", './sgtnclient.log')
26
21
 
27
22
  Dir[File.expand_path("../support/**/*.rb", __FILE__)].each {|f| require f }
28
23
 
29
24
  # Set logger for http
30
25
  http_log = File.open(File.expand_path('../log/http.log', __FILE__), "w")
31
- #Payment.api.http.set_debug_output(http_log)
32
26
 
33
27
  RSpec.configure do |config|
34
28
  config.filter_run_excluding :integration => true
35
29
  config.filter_run_excluding :disabled => true
36
30
  config.include SampleData
37
- # config.include PayPal::SDK::REST::DataTypes
38
31
  end
39
32
 
40
33
  WebMock.allow_net_connect!
@@ -5,20 +5,19 @@ describe SgtnClient do
5
5
 
6
6
  before :each do
7
7
  env = SgtnClient::Config.default_environment
8
- SgtnClient::Config.configurations[env]["bundle_mode"] = 'online'
8
+ SgtnClient::Config.configurations[env]["bundle_mode"] = 'offline'
9
9
  SgtnClient::Config.configurations[env]["cache_expiry_period"] = 1
10
- SgtnClient::Source.loadBundles("en")
10
+ SgtnClient::Source.loadBundles("default")
11
11
  end
12
12
 
13
13
  it "GETTranslation" do
14
14
 
15
15
  # get translation from server
16
16
  SgtnClient.logger.debug "----------Start to get translation from server---------"
17
- expect(SgtnClient::Translation.getString("JAVA", "com.vmware.loginsight.web.settings.stats.StatsTable.host", "zh-Hans")).to eq '主机'
18
-
17
+ expect(SgtnClient::Translation.getString("JAVA", "helloworld", "zh-Hans")).to eq '你好世界'
19
18
  # get translation from cache
20
19
  SgtnClient.logger.debug "----------Start to get translation from cache---------"
21
- expect(SgtnClient::Translation.getString("JAVA", "com.vmware.loginsight.web.settings.stats.StatsTable.host", "zh-Hans")).to eq '主机'
20
+ expect(SgtnClient::Translation.getString("JAVA", "helloworld", "zh-Hans")).to eq '你好世界'
22
21
 
23
22
  # get from server again after data is expired
24
23
  SgtnClient.logger.debug "----------Sleep 70s---------"
@@ -26,7 +25,7 @@ describe SgtnClient do
26
25
  #sleep 70
27
26
  puts Time.now
28
27
  SgtnClient.logger.debug "----------Start to get translation from expired cache---------"
29
- expect(SgtnClient::Translation.getString("JAVA", "com.vmware.loginsight.web.settings.stats.StatsTable.host", "zh-Hans")).to eq '主机'
28
+ expect(SgtnClient::Translation.getString("JAVA", "helloworld", "zh-Hans")).to eq '你好世界'
30
29
 
31
30
  SgtnClient.logger.debug "----------End to get translation from server---------"
32
31
  end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe SgtnClient do
4
+ describe "Locale" do
5
+
6
+ before :each do
7
+ end
8
+
9
+ it "fallback" do
10
+ expect(SgtnClient::LocaleUtil.fallback('ja-JP')).to eq 'ja'
11
+ expect(SgtnClient::LocaleUtil.fallback('de-DE')).to eq 'de'
12
+ expect(SgtnClient::LocaleUtil.fallback('zh')).to eq 'zh'
13
+ expect(SgtnClient::LocaleUtil.fallback('zh-Hans')).to eq 'zh-Hans'
14
+ expect(SgtnClient::LocaleUtil.fallback('zh-Hant')).to eq 'zh-Hant'
15
+ expect(SgtnClient::LocaleUtil.fallback('zh-CN')).to eq 'zh-Hans'
16
+ expect(SgtnClient::LocaleUtil.fallback('zh-TW')).to eq 'zh-Hant'
17
+ expect(SgtnClient::LocaleUtil.fallback('zh-Hans-CN')).to eq 'zh-Hans'
18
+ expect(SgtnClient::LocaleUtil.fallback('zh-Hant-TW')).to eq 'zh-Hant'
19
+ expect(SgtnClient::LocaleUtil.fallback('kong-kong')).to eq 'kong-kong'
20
+ end
21
+ end
22
+
23
+ end
@@ -6,25 +6,47 @@ describe SgtnClient do
6
6
  before :each do
7
7
  env = SgtnClient::Config.default_environment
8
8
  SgtnClient::Config.configurations[env]["bundle_mode"] = 'offline'
9
- SgtnClient::Source.loadBundles("en")
9
+ SgtnClient::Source.loadBundles("default")
10
10
  end
11
11
 
12
12
  it "GET" do
13
- expect(SgtnClient::Translation.getString("JAVA", "com.vmware.loginsight.web.settings.stats.StatsTable.host", "zh-Hans")).to eq '主机'
13
+ expect(SgtnClient::Translation.getString("JAVA", "helloworld", "zh-Hans")).to eq '你好世界'
14
14
  # get from cache in 2nd time
15
- expect(SgtnClient::Translation.getString("JAVA", "com.vmware.loginsight.web.settings.stats.StatsTable.host", "zh-Hans")).to eq '主机'
15
+ expect(SgtnClient::Translation.getString("JAVA", "helloworld", "zh-Hans")).to eq '你好世界'
16
+
17
+ expect(SgtnClient::Translation.getString_f("JAVA", "welcome", ["机器人", "虚拟世界"], "zh-Hans")).to eq '机器人,欢迎登录虚拟世界!'
18
+ # get from cache in 2nd time
19
+ expect(SgtnClient::Translation.getString_f("JAVA", "welcome", ["机器人", "虚拟世界"], "zh-Hans")).to eq '机器人,欢迎登录虚拟世界!'
20
+ end
21
+
22
+ it "GET_EN" do
23
+ expect(SgtnClient::Translation.getString("JAVA", "hello", "en")).to eq 'Hello'
24
+ # get from cache in 2nd time
25
+ expect(SgtnClient::Translation.getString("JAVA", "hello", "en")).to eq 'Hello'
16
26
  end
17
27
 
18
28
  it "GET_zh_CN" do
19
- expect(SgtnClient::Translation.getString("JAVA", "com.vmware.loginsight.web.settings.stats.StatsTable.host", "zh_CN")).to eq '主机'
29
+ expect(SgtnClient::Translation.getString("JAVA", "helloworld", "zh-CN")).to eq '你好世界'
20
30
  # get from cache in 2nd time
21
- expect(SgtnClient::Translation.getString("JAVA", "com.vmware.loginsight.web.settings.stats.StatsTable.host", "zh_CN")).to eq '主机'
31
+ expect(SgtnClient::Translation.getString("JAVA", "helloworld", "zh-CN")).to eq '你好世界'
22
32
  end
23
33
 
24
34
  it "NonExistingKey" do
25
- expect(SgtnClient::Translation.getString("JAVA", "hello", "zh-Hans")).to eq 'Hello world'
35
+ expect(SgtnClient::Translation.getString("JAVA", "hello", "zh-Hans")).to eq 'Hello'
36
+ # get from cache in 2nd time
37
+ expect(SgtnClient::Translation.getString("JAVA", "hello", "zh-Hans")).to eq 'Hello'
38
+
39
+ expect(SgtnClient::Translation.getString_f("JAVA", "login", ["Robot", "VM"], "zh-Hans")).to eq 'Robot login VM!'
40
+ # get from cache in 2nd time
41
+ expect(SgtnClient::Translation.getString_f("JAVA", "login", ["Robot", "VM"], "zh-Hans")).to eq 'Robot login VM!'
42
+ end
43
+
44
+ it "Component" do
45
+ jsonObj = SgtnClient::Translation.getStrings("JAVA", "zh-Hans");
46
+ expect(jsonObj["component"]).to eq 'JAVA'
26
47
  # get from cache in 2nd time
27
- expect(SgtnClient::Translation.getString("JAVA", "hello", "zh-Hans")).to eq 'Hello world'
48
+ jsonObj_c = SgtnClient::Translation.getStrings("JAVA", "zh-Hans");
49
+ expect(jsonObj_c["component"]).to eq 'JAVA'
28
50
  end
29
51
  end
30
52
 
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe SgtnClient do
4
+ describe "OnlineAPI" do
5
+
6
+ before :each do
7
+ env = SgtnClient::Config.default_environment
8
+ SgtnClient::CacheUtil.clear_cache()
9
+ SgtnClient::Config.configurations[env]["bundle_mode"] = 'offline'
10
+ SgtnClient::Source.loadBundles("default")
11
+ end
12
+
13
+ it "GET_EN" do
14
+ expect(SgtnClient::Translation.getString("JAVA", "helloworld", "en")).to eq 'Hello world'
15
+ # get from cache in 2nd time
16
+ expect(SgtnClient::Translation.getString("JAVA", "helloworld", "en")).to eq 'Hello world'
17
+ end
18
+
19
+ it "GET" do
20
+ expect(SgtnClient::Translation.getString("JAVA", "helloworld", "zh-Hans")).to eq '你好世界'
21
+ # get from cache in 2nd time
22
+ expect(SgtnClient::Translation.getString("JAVA", "helloworld", "zh-Hans")).to eq '你好世界'
23
+ end
24
+
25
+ it "NonExistingKey" do
26
+ expect(SgtnClient::Translation.getString("JAVA", "hello", "zh-Hans")).to eq 'Hello'
27
+ # get from cache in 2nd time
28
+ expect(SgtnClient::Translation.getString("JAVA", "hello", "zh-Hans")).to eq 'Hello'
29
+ end
30
+ end
31
+
32
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: singleton-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.3
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: 2021-07-08 00:00:00.000000000 Z
11
+ date: 2021-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -202,20 +202,6 @@ dependencies:
202
202
  - - "~>"
203
203
  - !ruby/object:Gem::Version
204
204
  version: '0.8'
205
- - !ruby/object:Gem::Dependency
206
- name: rest-client
207
- requirement: !ruby/object:Gem::Requirement
208
- requirements:
209
- - - "~>"
210
- - !ruby/object:Gem::Version
211
- version: '2.0'
212
- type: :runtime
213
- prerelease: false
214
- version_requirements: !ruby/object:Gem::Requirement
215
- requirements:
216
- - - "~>"
217
- - !ruby/object:Gem::Version
218
- version: '2.0'
219
205
  - !ruby/object:Gem::Dependency
220
206
  name: multi_json
221
207
  requirement: !ruby/object:Gem::Requirement
@@ -244,8 +230,8 @@ dependencies:
244
230
  - - "~>"
245
231
  - !ruby/object:Gem::Version
246
232
  version: '6.6'
247
- description: A Singleton client for Ruby
248
- email: li@vmware.com
233
+ description: Singleton Ruby client
234
+ email: g11n-vip-project@vmware.com
249
235
  executables: []
250
236
  extensions: []
251
237
  extra_rdoc_files:
@@ -254,10 +240,6 @@ files:
254
240
  - Gemfile
255
241
  - README.md
256
242
  - Rakefile
257
- - lib/generators/sgtnclient/USAGE
258
- - lib/generators/sgtnclient/install_generator.rb
259
- - lib/generators/sgtnclient/templates/sgtnclient.rb
260
- - lib/generators/sgtnclient/templates/sgtnclient.yml
261
243
  - lib/sgtn-client/api/source.rb
262
244
  - lib/sgtn-client/api/translation.rb
263
245
  - lib/sgtn-client/core/cache.rb
@@ -267,18 +249,18 @@ files:
267
249
  - lib/sgtn-client/core/request.rb
268
250
  - lib/sgtn-client/sgtn-client.rb
269
251
  - lib/sgtn-client/util/cache-util.rb
252
+ - lib/sgtn-client/util/locale-util.rb
270
253
  - lib/sgtn-client/util/validate-util.rb
271
254
  - lib/singleton-ruby.rb
272
255
  - lib/version.rb
273
- - spec/config/locales/default/JAVA/en.yml
274
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_de.json
275
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_en.json
276
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_latest.json
277
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hans.json
278
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hant.json
279
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh_CN.json
280
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/creation.json
281
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/version.json
256
+ - spec/config/locales/default/JAVA/default.yml
257
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_de.json
258
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_en.json
259
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_latest.json
260
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_zh-Hans.json
261
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_zh-Hant.json
262
+ - spec/config/locales/l10n/bundles/test/4.8.1/creation.json
263
+ - spec/config/locales/l10n/bundles/test/4.8.1/version.json
282
264
  - spec/config/sample_data.yml
283
265
  - spec/config/sgtnclient-invalidate.yml
284
266
  - spec/config/sgtnclient.yml
@@ -288,13 +270,14 @@ files:
288
270
  - spec/unit/cache_spec.rb
289
271
  - spec/unit/config_spec.rb
290
272
  - spec/unit/inconfig_spec.rb
273
+ - spec/unit/locale_spec.rb
291
274
  - spec/unit/logging_spec.rb
292
275
  - spec/unit/offclient_spec.rb
293
- - spec/unit/restclient_spec.rb
276
+ - spec/unit/onclient_spec.rb
294
277
  - spec/unit/version_spec.rb
295
278
  homepage: https://github.com/vmware/singleton
296
279
  licenses:
297
- - MIT
280
+ - EPL
298
281
  metadata: {}
299
282
  post_install_message:
300
283
  rdoc_options: []
@@ -311,20 +294,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
311
294
  - !ruby/object:Gem::Version
312
295
  version: '0'
313
296
  requirements: []
314
- rubygems_version: 3.1.4
297
+ rubygems_version: 3.0.9
315
298
  signing_key:
316
299
  specification_version: 4
317
- summary: Singleton client for Ruby.
300
+ summary: Singleton Ruby client
318
301
  test_files:
319
- - spec/config/locales/default/JAVA/en.yml
320
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_de.json
321
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_en.json
322
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_latest.json
323
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hans.json
324
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hant.json
325
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh_CN.json
326
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/creation.json
327
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/version.json
302
+ - spec/config/locales/default/JAVA/default.yml
303
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_de.json
304
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_en.json
305
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_latest.json
306
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_zh-Hans.json
307
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_zh-Hant.json
308
+ - spec/config/locales/l10n/bundles/test/4.8.1/creation.json
309
+ - spec/config/locales/l10n/bundles/test/4.8.1/version.json
328
310
  - spec/config/sample_data.yml
329
311
  - spec/config/sgtnclient-invalidate.yml
330
312
  - spec/config/sgtnclient.yml
@@ -334,7 +316,8 @@ test_files:
334
316
  - spec/unit/cache_spec.rb
335
317
  - spec/unit/config_spec.rb
336
318
  - spec/unit/inconfig_spec.rb
319
+ - spec/unit/locale_spec.rb
337
320
  - spec/unit/logging_spec.rb
338
321
  - spec/unit/offclient_spec.rb
339
- - spec/unit/restclient_spec.rb
322
+ - spec/unit/onclient_spec.rb
340
323
  - spec/unit/version_spec.rb
@@ -1,3 +0,0 @@
1
- To copy a PayPal SDK default configuration and initializer to your Rails App.
2
-
3
- rails g sgtnclient:install
@@ -1,15 +0,0 @@
1
- module SgtnClient
2
- module Generators
3
- class InstallGenerator < Rails::Generators::Base
4
- source_root File.expand_path('../templates', __FILE__)
5
-
6
- def copy_config_file
7
- copy_file "sgtnclient.yml", "config/sgtnclient.yml"
8
- end
9
-
10
- def copy_initializer_file
11
- copy_file "sgtnclient.rb", "config/initializers/sgtnclient.rb"
12
- end
13
- end
14
- end
15
- end
@@ -1,2 +0,0 @@
1
- SgtnClient.load("config/sgtnclient.yml", Rails.env)
2
- PSgtnClient.logger = Rails.logger
@@ -1,33 +0,0 @@
1
- test: &default
2
-
3
- # Credentials for REST APIs
4
- client_id: tee
5
- client_secret: 89987
6
-
7
- # Mode can be 'live' or 'sandbox'
8
- mode: sandbox
9
-
10
- # Credentials for Classic APIs
11
- app_id: APP-80W284485P519543T
12
- username: linr
13
- password: fdasf
14
- signature: sfds-RWy
15
- # # With Certificate
16
- # cert_path: "config/cert_key.pem"
17
- sandbox_email_address: linr@vmware.com
18
-
19
- # #Product Name
20
- product_name: logInsight
21
-
22
- # # bundle version
23
- version: 4.8.1
24
-
25
- # # HTTP Proxy
26
- vip_server: https://g11n-vip-dev-1.eng.vmware.com:8090
27
-
28
- development:
29
- <<: *default
30
-
31
- production:
32
- <<: *default
33
- mode: live
@@ -1,2 +0,0 @@
1
- en:
2
- hello: "Hello world"
@@ -1,11 +0,0 @@
1
- {
2
- "component" : "JAVA",
3
- "messages" : {
4
- "com.vmware.loginsight.web.settings.stats.StatsTable.host" : "Host",
5
- "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond" : "Erfassungsrate für Ereignisse (pro Sekunde)",
6
- "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond.help" : "Die tatsächliche Erfassungsrate (Syslog + API) jedes Knotens nach der Nachrichtenneuverteilung.<br />Log Insight-Knoten verteilen Nachrichten neu, um eine gleichmäßige Erfassung pro Knoten zu erzielen und für eine ausgewogene Aufbewahrung und Leistung zu sorgen.<br /><br />Beachten Sie, dass die Erfassungsrate für jeden Knoten unter der konfigurierten maximalen Erfassungsrate eines Knotens liegen muss.<br /><br />Informationen zur tatsächlichen Rate der Ereignisse, die vor der Nachrichtenneuverteilung direkt an jeden Knoten gesandt werden, finden Sie in den Tabellen \"Eingangsrate für Syslog-Ereignisse (pro Sekunde)\" und \"Eingangsrate für API-Ereignisse (pro Sekunde)\" unten.",
7
- "com.vmware.loginsight.web.settings.stats.StatsTableType.syslogEventsIncomingRatePerSecond" : "Eingangsrate für Syslog-Ereignisse (pro Sekunde)",
8
- "com.vmware.loginsight.web.utilities.EmailUtil.upgrade.body48" : "Auf {0} wird nun Version {1} ausgeführt. Es folgen einige interessante neue Funktionen der Version {1}. Wir schätzen wie immer Ihre anhaltende Unterstützung und freuen uns auf Ihre Rückmeldungen unter {3} und {4} auf Twitter.<br /><br /><b>vRealize Log Insight-Serverfunktionen</b><br />• TODO weitere Serverfunktionen hinzufügen.<br /><br /><b>vRealize Log Insight-Agentenfunktionen</b><br />• TODO weitere Agentenfunktionen hinzufügen.<br /><br />Weitere Informationen zu den neuen Funktionen von {0} finden Sie unter {0} v{1} {2}.<br /><br />Viel Spaß bei der Protokollierung<br />Das {0}-Team<br /><br />"
9
- },
10
- "locale" : "de"
11
- }
@@ -1,12 +0,0 @@
1
- {
2
- "component" : "JAVA",
3
- "messages" : {
4
- "hello": "@hello@",
5
- "com.vmware.loginsight.web.settings.stats.StatsTable.host" : "Host",
6
- "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond" : "Events Ingestion Rate (Per Second)",
7
- "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond.help" : "The actual ingestion rate (syslog + API) of each node after message rebalancing.<br />Log Insight nodes will rebalance messages to attempt uniform ingestion per node for balanced retention and performance.<br /><br />Note that the ingestion rate of each node must be below the ingestion rate configuration maximum for a node.<br /><br />For the actual rate of events being sent directly to each node prior to message rebalancing, see the Syslog Events Incoming Rate (Per Second) and API Events Incoming Rate (Per Second) tables below.",
8
- "com.vmware.loginsight.web.settings.stats.StatsTableType.syslogEventsIncomingRatePerSecond" : "Syslog Events Incoming Rate (Per Second)",
9
- "com.vmware.loginsight.web.actions.settings.HealthActionBean.machineLearningAliases" : "Machine Learning Aliases"
10
- },
11
- "locale" : "en"
12
- }
@@ -1,11 +0,0 @@
1
- {
2
- "component" : "JAVA",
3
- "messages" : {
4
- "com.vmware.loginsight.web.settings.stats.StatsTableType.queryOrigin" : "Query Origin",
5
- "com.vmware.loginsight.web.settings.stats.StatsTableType.queryOrigin.help" : "The origin refers to where the query originated from:<br /><br />Interactive Analytics<br />• <span style=\"font-weight: bold;\">Chart</span> - visualization above the search bar<br />• <span style=\"font-weight: bold;\">Events</span> - tab below the search bar<br />• <span style=\"font-weight: bold;\">Event Types</span> - tab below the search bar<br />• <span style=\"font-weight: bold;\">Event Trends</span> - tab below the search bar<br />• <span style=\"font-weight: bold;\">Alerts</span> - from the alert icon to the right of the search bar<br />• <span style=\"font-weight: bold;\">Facet</span> - chart when expanding a field<br /><br />Internal<br />• <span style=\"font-weight: bold;\">Precompute</span> - cache queries<br />• <span style=\"font-weight: bold;\">Schema</span>\t- machine learning queries<br />• <span style=\"font-weight: bold;\">Tools</span> - internal-only<br />• <span style=\"font-weight: bold;\">Other</span> - internal-only<br />",
6
- "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond" : "Events Ingestion Rate (Per Second)",
7
- "com.vmware.loginsight.web.settings.stats.StatsTable.host" : "Host",
8
- "com.vmware.loginsight.web.utilities.EmailUtil.upgrade.body48" : "{0} is now running version {1}. Below are some of the exciting new features we've added to the {1} release. As always, we appreciate your continued support and value your feedback in our {3} and {4} on Twitter.<br /><br /><b>vRealize Log Insight Server Features</b><br />• TODO add server features.<br /><br /><b>vRealize Log Insight Agent Features</b><br />• TODO add agent features.<br /><br />For more information about {0}'s new features, take a look at the {0} v{1} {2}.<br /><br />Happy Logging,<br />The {0} Team<br /><br \\>"
9
- },
10
- "locale" : "latest"
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "component" : "JAVA",
3
- "messages" : {
4
- "com.vmware.loginsight.web.settings.stats.StatsTable.host" : "主机",
5
- "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond" : "事件载入速率 (每秒)",
6
- "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond.help" : "消息再平衡之后每个节点的实际载入速率 (syslog + API)。<br />Log Insight 节点将再平衡消息以尝试每节点的统一载入,从而实现平衡保留和性能。<br /><br />请注意,每个节点的载入速率必须低于配置的最大节点载入速率。<br /><br />有关消息再平衡之前直接发送到每个节点的事件的实际速率,请参见下述“Syslog 事件入站速率 (每秒)”和“API 事件入站速率 (每秒)”表。",
7
- "com.vmware.loginsight.web.settings.stats.StatsTableType.syslogEventsIncomingRatePerSecond" : "Syslog 事件入站速率 (每秒)",
8
- "com.vmware.loginsight.web.utilities.EmailUtil.upgrade.body48" : "{0} 现在正在运行版本 {1}。下面是 {1} 版本中新增的一些出色功能。我们感谢您一如既往地支持,同时非常重视您通过 Twitter 针对我们的 {3} 和 {4} 提供的反馈。<br /><br /><b>vRealize Log Insight 服务器功能</b><br />• TODO 增加服务器功能。<br /><br /><b>vRealize Log Insight 代理功能</b><br />• TODO 增加代理功能。<br /><br />有关 {0} 的新功能的详细信息,请查看 {0} v{1} {2}。<br /><br />祝您使用愉快!<br />{0} 团队<br /><br />"
9
- },
10
- "locale" : "zh-Hans"
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "component" : "JAVA",
3
- "messages" : {
4
- "com.vmware.loginsight.web.settings.stats.StatsTable.host" : "主機",
5
- "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond" : "事件擷取速率 (每秒)",
6
- "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond.help" : "訊息重新平衡之後每個節點的實際擷取速率 (syslog + API)。<br /> Log Insight 節點將重新平衡訊息,以嘗試每個節點的統一擷取,進而取得平衡保留和效能。<br /><br /> 請注意,每個節點的擷取速率必須低於節點的擷取速率組態上限。<br /><br /> 如需在訊息重新平衡之前直接傳送至每個節點的事件的實際速率,請參閱下列「Syslog 事件傳入速率 (每秒)」和「API 事件傳入速率 (每秒)」資料表。",
7
- "com.vmware.loginsight.web.settings.stats.StatsTableType.syslogEventsIncomingRatePerSecond" : "Syslog 事件傳入速率 (每秒)",
8
- "com.vmware.loginsight.web.utilities.EmailUtil.upgrade.body48" : "{0} 現在正在執行版本 {1}。以下是已新增至 {1} 版本的部分嶄新功能。我們感謝您一直以來的支持,並十分重視您在 Twitter 對我們的 {3} 和 {4} 所提供的意見。<br /><br /><b>vRealize Log Insight 伺服器功能</b><br />• TODO 新增伺服器功能。<br /><br /><b>vRealize Log Insight 代理程式功能</b><br />• TODO 新增代理程式功能。<br /><br />如需關於 {0} 新功能的詳細資訊,請查看 {0} v{1} {2}。<br /><br />祝您使用愉快!<br />{0} 團隊<br /><br />"
9
- },
10
- "locale" : "zh-Hant"
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "component" : "JAVA",
3
- "messages" : {
4
- "com.vmware.loginsight.web.settings.stats.StatsTable.host" : "主机",
5
- "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond" : "事件载入速率 (每秒)",
6
- "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond.help" : "消息再平衡之后每个节点的实际载入速率 (syslog + API)。<br />Log Insight 节点将再平衡消息以尝试每节点的统一载入,从而实现平衡保留和性能。<br /><br />请注意,每个节点的载入速率必须低于配置的最大节点载入速率。<br /><br />有关消息再平衡之前直接发送到每个节点的事件的实际速率,请参见下述“Syslog 事件入站速率 (每秒)”和“API 事件入站速率 (每秒)”表。",
7
- "com.vmware.loginsight.web.settings.stats.StatsTableType.syslogEventsIncomingRatePerSecond" : "Syslog 事件入站速率 (每秒)",
8
- "com.vmware.loginsight.web.utilities.EmailUtil.upgrade.body48" : "{0} 现在正在运行版本 {1}。下面是 {1} 版本中新增的一些出色功能。我们感谢您一如既往地支持,同时非常重视您通过 Twitter 针对我们的 {3} 和 {4} 提供的反馈。<br /><br /><b>vRealize Log Insight 服务器功能</b><br />• TODO 增加服务器功能。<br /><br /><b>vRealize Log Insight 代理功能</b><br />• TODO 增加代理功能。<br /><br />有关 {0} 的新功能的详细信息,请查看 {0} v{1} {2}。<br /><br />祝您使用愉快!<br />{0} 团队<br /><br />"
9
- },
10
- "locale" : "zh-Hans"
11
- }
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe SgtnClient do
4
- describe "OnlineAPI" do
5
-
6
- before :each do
7
- env = SgtnClient::Config.default_environment
8
- SgtnClient::Config.configurations[env]["bundle_mode"] = 'online'
9
- SgtnClient::Source.loadBundles("en")
10
- end
11
-
12
- it "GET" do
13
- expect(SgtnClient::Translation.getString("JAVA", "com.vmware.loginsight.web.settings.stats.StatsTable.host", "zh-Hans")).to eq '主机'
14
- # get from cache in 2nd time
15
- expect(SgtnClient::Translation.getString("JAVA", "com.vmware.loginsight.web.settings.stats.StatsTable.host", "zh-Hans")).to eq '主机'
16
- end
17
-
18
- it "NonExistingKey" do
19
- expect(SgtnClient::Translation.getString("JAVA", "hello", "zh-Hans")).to eq 'Hello world'
20
- # get from cache in 2nd time
21
- expect(SgtnClient::Translation.getString("JAVA", "hello", "zh-Hans")).to eq 'Hello world'
22
- end
23
- end
24
-
25
- end