singleton-ruby 0.0.8 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -3
  3. data/README.md +26 -0
  4. data/lib/generators/sgtnclient/USAGE +1 -1
  5. data/lib/generators/sgtnclient/templates/sgtnclient.yml +3 -3
  6. data/lib/sgtn-client/api/source.rb +18 -5
  7. data/lib/sgtn-client/api/translation.rb +36 -6
  8. data/lib/sgtn-client/core/config.rb +0 -7
  9. data/lib/sgtn-client/core/exceptions.rb +1 -1
  10. data/lib/sgtn-client/sgtn-client.rb +1 -2
  11. data/lib/sgtn-client/util/cache-util.rb +4 -0
  12. data/lib/sgtn-client/util/locale-util.rb +31 -0
  13. data/lib/version.rb +1 -1
  14. data/spec/config/locales/default/JAVA/default.yml +5 -0
  15. data/spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_de.json +8 -0
  16. data/spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_en.json +8 -0
  17. data/spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_latest.json +8 -0
  18. data/spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_zh-Hans.json +8 -0
  19. data/spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_zh-Hant.json +8 -0
  20. data/spec/config/locales/l10n/bundles/{logInsight → test}/4.8.1/creation.json +0 -0
  21. data/spec/config/locales/l10n/bundles/{logInsight → test}/4.8.1/version.json +0 -0
  22. data/spec/config/sgtnclient-invalidate.yml +3 -3
  23. data/spec/config/sgtnclient.yml +3 -3
  24. data/spec/spec_helper.rb +0 -1
  25. data/spec/unit/cache_spec.rb +5 -6
  26. data/spec/unit/locale_spec.rb +23 -0
  27. data/spec/unit/offclient_spec.rb +29 -7
  28. data/spec/unit/onclient_spec.rb +32 -0
  29. metadata +24 -57
  30. data/lib/sgtn-client/cldr/core_ext.rb +0 -3
  31. data/lib/sgtn-client/cldr/localized_date.rb +0 -27
  32. data/lib/sgtn-client/cldr/localized_datetime.rb +0 -33
  33. data/lib/sgtn-client/cldr/localized_time.rb +0 -27
  34. data/spec/config/locales/default/JAVA/en.yml +0 -2
  35. data/spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_de.json +0 -11
  36. data/spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_en.json +0 -12
  37. data/spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_latest.json +0 -11
  38. data/spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hans.json +0 -11
  39. data/spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hant.json +0 -11
  40. data/spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh_CN.json +0 -11
  41. data/spec/unit/datetime_spec.rb +0 -43
  42. data/spec/unit/restclient_spec.rb +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b456e3f07aebae2f889f02923ad657d42fe8169599e7514b52a11ec55e05ada2
4
- data.tar.gz: fdebf95d14b50ecfb43f7d6622105ce85c7fc5ac95fedbc20571256dcd56b687
3
+ metadata.gz: bcc331c8950f6406499f27695bb3e7973745acd2b7a07454b5482f28ee7ba693
4
+ data.tar.gz: 9630c5e08d8e51c942da3df7dd58583499ca912e7a801b499c939c0022bca66e
5
5
  SHA512:
6
- metadata.gz: bc5e2892ecda039bb98adbd9343945d18324f2b22b4f99eedd233178368131064651c565a1718904821b2016b1501d1d89ea15a7d4ccc1e85d26b202b421f478
7
- data.tar.gz: 2bc77e34f9a62174e9fbd6d62e9200992a4e93ea0bedb56223976de7455267dba9bae49ceff01c8ae43f76319c0d640681ebb6f2fd51daf4ec11c48f34e98f83
6
+ metadata.gz: 38177b4b4e74294988cfcfa5a23046f3bcaa0494f3287d69cc3e7a786863e6ca5c833f621cad746f602e8071bafa55a15a3d22d63addbfe13248bd6a421ca533
7
+ data.tar.gz: e705db8c097ce7eb685fccc7258d5bbdfa725087cf84ea08cb41d1acb08fe224282de166fca611be0b54860ecf51bd291bee940b526df3a0fdcb1e1fc2e00785
data/Gemfile CHANGED
@@ -13,6 +13,3 @@ group :test do
13
13
  gem 'rspec'
14
14
  gem 'webmock'
15
15
  end
16
-
17
- gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
18
- #gem 'releasinator', '~> 0.6'
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
 
@@ -1,3 +1,3 @@
1
- To copy a PayPal SDK default configuration and initializer to your Rails App.
1
+ To copy a sgtnclient SDK default configuration and initializer to your Rails App.
2
2
 
3
3
  rails g sgtnclient:install
@@ -14,16 +14,16 @@ test: &default
14
14
  signature: sfds-RWy
15
15
  # # With Certificate
16
16
  # cert_path: "config/cert_key.pem"
17
- sandbox_email_address: linr@vmware.com
17
+ sandbox_email_address: linr@aa.com
18
18
 
19
19
  # #Product Name
20
- product_name: logInsight
20
+ product_name: test
21
21
 
22
22
  # # bundle version
23
23
  version: 4.8.1
24
24
 
25
25
  # # HTTP Proxy
26
- vip_server: https://g11n-vip-dev-1.eng.vmware.com:8090
26
+ vip_server: https://server:8090
27
27
 
28
28
  development:
29
29
  <<: *default
@@ -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 itmes
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)
@@ -66,5 +67,3 @@ module SgtnClient
66
67
  end
67
68
 
68
69
  end
69
-
70
- require 'sgtn-client/cldr/core_ext'
@@ -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, 8].freeze
2
+ VERSION_INFO = [0, 1, 2].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
+ }
@@ -14,16 +14,16 @@ test: &default
14
14
  signature: sfds-RWy
15
15
  # # With Certificate
16
16
  # cert_path: "config/cert_key.pem"
17
- sandbox_email_address: linr@vmware.com
17
+ sandbox_email_address: linr@aa.com
18
18
 
19
19
  # #Product Name
20
- product_name: logInsight
20
+ product_name: test
21
21
 
22
22
  # # bundle version
23
23
  version: 4.8
24
24
 
25
25
  # # HTTP Proxy
26
- vip_server: https://g11n-vip-dev-1.eng.vmware.com:8090
26
+ vip_server: https://server:8090
27
27
 
28
28
  # # mode of bundle: online/offline
29
29
  bundle_mode: offline1www
@@ -14,16 +14,16 @@ test: &default
14
14
  signature: sfds-RWy
15
15
  # # With Certificate
16
16
  # cert_path: "config/cert_key.pem"
17
- sandbox_email_address: linr@vmware.com
17
+ sandbox_email_address: linr@aa.com
18
18
 
19
19
  # #Product Name
20
- product_name: logInsight
20
+ product_name: test
21
21
 
22
22
  # # bundle version
23
23
  version: 4.8.1
24
24
 
25
25
  # # HTTP Proxy
26
- vip_server: https://g11n-vip-dev-1.eng.vmware.com:8090
26
+ vip_server: https://server:8090
27
27
 
28
28
  # # mode of bundle: online/offline
29
29
  bundle_mode: offline
data/spec/spec_helper.rb CHANGED
@@ -34,7 +34,6 @@ RSpec.configure do |config|
34
34
  config.filter_run_excluding :integration => true
35
35
  config.filter_run_excluding :disabled => true
36
36
  config.include SampleData
37
- # config.include PayPal::SDK::REST::DataTypes
38
37
  end
39
38
 
40
39
  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.8
4
+ version: 0.1.2
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-06-30 00:00:00.000000000 Z
11
+ date: 2021-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
- - !ruby/object:Gem::Dependency
42
- name: twitter_cldr
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '6.6'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '6.6'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: webmock
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -216,20 +202,6 @@ dependencies:
216
202
  - - "~>"
217
203
  - !ruby/object:Gem::Version
218
204
  version: '0.8'
219
- - !ruby/object:Gem::Dependency
220
- name: rest-client
221
- requirement: !ruby/object:Gem::Requirement
222
- requirements:
223
- - - "~>"
224
- - !ruby/object:Gem::Version
225
- version: '2.0'
226
- type: :runtime
227
- prerelease: false
228
- version_requirements: !ruby/object:Gem::Requirement
229
- requirements:
230
- - - "~>"
231
- - !ruby/object:Gem::Version
232
- version: '2.0'
233
205
  - !ruby/object:Gem::Dependency
234
206
  name: multi_json
235
207
  requirement: !ruby/object:Gem::Requirement
@@ -274,10 +246,6 @@ files:
274
246
  - lib/generators/sgtnclient/templates/sgtnclient.yml
275
247
  - lib/sgtn-client/api/source.rb
276
248
  - lib/sgtn-client/api/translation.rb
277
- - lib/sgtn-client/cldr/core_ext.rb
278
- - lib/sgtn-client/cldr/localized_date.rb
279
- - lib/sgtn-client/cldr/localized_datetime.rb
280
- - lib/sgtn-client/cldr/localized_time.rb
281
249
  - lib/sgtn-client/core/cache.rb
282
250
  - lib/sgtn-client/core/config.rb
283
251
  - lib/sgtn-client/core/exceptions.rb
@@ -285,18 +253,18 @@ files:
285
253
  - lib/sgtn-client/core/request.rb
286
254
  - lib/sgtn-client/sgtn-client.rb
287
255
  - lib/sgtn-client/util/cache-util.rb
256
+ - lib/sgtn-client/util/locale-util.rb
288
257
  - lib/sgtn-client/util/validate-util.rb
289
258
  - lib/singleton-ruby.rb
290
259
  - lib/version.rb
291
- - spec/config/locales/default/JAVA/en.yml
292
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_de.json
293
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_en.json
294
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_latest.json
295
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hans.json
296
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hant.json
297
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh_CN.json
298
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/creation.json
299
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/version.json
260
+ - spec/config/locales/default/JAVA/default.yml
261
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_de.json
262
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_en.json
263
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_latest.json
264
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_zh-Hans.json
265
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_zh-Hant.json
266
+ - spec/config/locales/l10n/bundles/test/4.8.1/creation.json
267
+ - spec/config/locales/l10n/bundles/test/4.8.1/version.json
300
268
  - spec/config/sample_data.yml
301
269
  - spec/config/sgtnclient-invalidate.yml
302
270
  - spec/config/sgtnclient.yml
@@ -305,11 +273,11 @@ files:
305
273
  - spec/support/sample_data.rb
306
274
  - spec/unit/cache_spec.rb
307
275
  - spec/unit/config_spec.rb
308
- - spec/unit/datetime_spec.rb
309
276
  - spec/unit/inconfig_spec.rb
277
+ - spec/unit/locale_spec.rb
310
278
  - spec/unit/logging_spec.rb
311
279
  - spec/unit/offclient_spec.rb
312
- - spec/unit/restclient_spec.rb
280
+ - spec/unit/onclient_spec.rb
313
281
  - spec/unit/version_spec.rb
314
282
  homepage: https://github.com/vmware/singleton
315
283
  licenses:
@@ -330,20 +298,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
330
298
  - !ruby/object:Gem::Version
331
299
  version: '0'
332
300
  requirements: []
333
- rubygems_version: 3.1.4
301
+ rubygems_version: 3.0.9
334
302
  signing_key:
335
303
  specification_version: 4
336
304
  summary: Singleton client for Ruby.
337
305
  test_files:
338
- - spec/config/locales/default/JAVA/en.yml
339
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_de.json
340
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_en.json
341
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_latest.json
342
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hans.json
343
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hant.json
344
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh_CN.json
345
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/creation.json
346
- - spec/config/locales/l10n/bundles/logInsight/4.8.1/version.json
306
+ - spec/config/locales/default/JAVA/default.yml
307
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_de.json
308
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_en.json
309
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_latest.json
310
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_zh-Hans.json
311
+ - spec/config/locales/l10n/bundles/test/4.8.1/JAVA/messages_zh-Hant.json
312
+ - spec/config/locales/l10n/bundles/test/4.8.1/creation.json
313
+ - spec/config/locales/l10n/bundles/test/4.8.1/version.json
347
314
  - spec/config/sample_data.yml
348
315
  - spec/config/sgtnclient-invalidate.yml
349
316
  - spec/config/sgtnclient.yml
@@ -352,9 +319,9 @@ test_files:
352
319
  - spec/support/sample_data.rb
353
320
  - spec/unit/cache_spec.rb
354
321
  - spec/unit/config_spec.rb
355
- - spec/unit/datetime_spec.rb
356
322
  - spec/unit/inconfig_spec.rb
323
+ - spec/unit/locale_spec.rb
357
324
  - spec/unit/logging_spec.rb
358
325
  - spec/unit/offclient_spec.rb
359
- - spec/unit/restclient_spec.rb
326
+ - spec/unit/onclient_spec.rb
360
327
  - spec/unit/version_spec.rb
@@ -1,3 +0,0 @@
1
- require 'sgtn-client/cldr/localized_datetime'
2
- require 'sgtn-client/cldr/localized_date'
3
- require 'sgtn-client/cldr/localized_time'
@@ -1,27 +0,0 @@
1
- require 'date'
2
- require 'time'
3
-
4
- Date.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
5
- def to_full_s(locale = TwitterCldr.locale)
6
- self.to_datetime().to_date().to_full_s
7
- end
8
- LOCALIZE
9
-
10
- Date.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
11
- def to_long_s(locale = TwitterCldr.locale)
12
- self.to_datetime().to_date().to_long_s
13
- end
14
- LOCALIZE
15
-
16
- Date.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
17
- def to_medium_s(locale = TwitterCldr.locale)
18
- self.to_datetime().to_date().to_medium_s
19
- end
20
- LOCALIZE
21
-
22
-
23
- Date.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
24
- def to_short_s(locale = TwitterCldr.locale)
25
- self.to_datetime().to_date().to_short_s
26
- end
27
- LOCALIZE
@@ -1,33 +0,0 @@
1
- require 'date'
2
- require 'time'
3
-
4
- DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
5
- def to_full_s(locale = TwitterCldr.locale)
6
- self.localize(locale).to_full_s
7
- end
8
- LOCALIZE
9
-
10
- DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
11
- def to_long_s(locale = TwitterCldr.locale)
12
- self.localize(locale).to_long_s
13
- end
14
- LOCALIZE
15
-
16
- DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
17
- def to_medium_s(locale = TwitterCldr.locale)
18
- self.localize(locale).to_medium_s
19
- end
20
- LOCALIZE
21
-
22
-
23
- DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
24
- def to_short_s(locale = TwitterCldr.locale)
25
- self.localize(locale).to_short_s
26
- end
27
- LOCALIZE
28
-
29
- DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
30
- def to_date(locale = TwitterCldr.locale)
31
- self.localize(locale).to_date
32
- end
33
- LOCALIZE
@@ -1,27 +0,0 @@
1
- require 'date'
2
- require 'time'
3
-
4
- Time.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
5
- def to_full_s(locale = TwitterCldr.locale)
6
- self.localize(locale).to_full_s
7
- end
8
- LOCALIZE
9
-
10
- Time.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
11
- def to_long_s(locale = TwitterCldr.locale)
12
- self.localize(locale).to_long_s
13
- end
14
- LOCALIZE
15
-
16
- Time.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
17
- def to_medium_s(locale = TwitterCldr.locale)
18
- self.localize(locale).to_medium_s
19
- end
20
- LOCALIZE
21
-
22
-
23
- Time.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
24
- def to_short_s(locale = TwitterCldr.locale)
25
- self.localize(locale).to_short_s
26
- end
27
- LOCALIZE
@@ -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,43 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe SgtnClient do
4
- describe "DateTime" do
5
-
6
- before :each do
7
-
8
- end
9
-
10
- it "DateTime" do
11
- d = DateTime.new(2007,11,19,8,37,48,"-06:00")
12
- expect(d.to_full_s(:es)).to eq 'lunes, 19 de noviembre de 2007, 14:37:48 (tiempo universal coordinado)'
13
- expect(d.to_long_s(:es)).to eq '19 de noviembre de 2007, 14:37:48 UTC'
14
- expect(d.to_medium_s(:es)).to eq '19 nov 2007 14:37:48'
15
- expect(d.to_short_s(:es)).to eq '19/11/07 14:37'
16
- end
17
-
18
- it "Date0" do
19
- d = Date.new(2001,2,3)
20
- expect(d.to_full_s(:es)).to eq 'Saturday, February 3, 2001'
21
- expect(d.to_long_s(:es)).to eq 'February 3, 2001'
22
- expect(d.to_medium_s(:es)).to eq 'Feb 3, 2001'
23
- expect(d.to_short_s(:es)).to eq '2/3/01'
24
- end
25
-
26
- it "Date" do
27
- d = DateTime.new(2007,11,19,8,37,48,"-06:00")
28
- expect(d.to_date(:es).to_full_s).to eq 'lunes, 19 de noviembre de 2007'
29
- expect(d.to_date(:es).to_long_s).to eq '19 de noviembre de 2007'
30
- expect(d.to_date(:es).to_medium_s).to eq '19 nov 2007'
31
- expect(d.to_date(:es).to_short_s).to eq '19/11/07'
32
- end
33
-
34
- it "time" do
35
- d = Time.new(2007,11,1,15,25,0, "+09:00")
36
- expect(d.to_full_s(:es)).to eq '6:25:00 (tiempo universal coordinado)'
37
- expect(d.to_long_s(:es)).to eq '6:25:00 UTC'
38
- expect(d.to_medium_s(:es)).to eq '6:25:00'
39
- expect(d.to_short_s(:es)).to eq '6:25'
40
- end
41
- end
42
-
43
- end
@@ -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