vmware / singleton

A service that provides support for Software Internationalization and Localization
Other
68 stars 64 forks source link

[BUG] [Ruby Client] Can't configure source and fallback locales in config file. #1478

Open jessiejuachon opened 2 years ago

jessiejuachon commented 2 years ago

Describe the bug The client is not fetching a list of fallback locales and source localle from client configuration file. Instead, a "default" locale is hardcoded.

To Reproduce Steps to reproduce the behavior:

  1. Use the ruby client in a sample application.
  2. As in this code in the sample app, the following line loads the source bundle: SgtnClient::Source.loadBundles("default")
  3. Error: Step 2 also initializes SgtnClient::Config.configurations.default to "default". The value should have come from the config file sgtnclient.yml instead.

Notice that in the client configuration file, there is no config to set the following:

Expected behavior The above two configurations must be in the client config file. These are to be used for the client library workflow logic below.

When target locale is not supported, invalid or nil: a. If list of fallback locales is NOT configured in the client config file, getString must return the source string. b. If list of fallback locales is configured in the client config file, getString must use the next fallback locale from the list as target locale, and return the translation. It must go through the list until it is able to return a translation in a fallback locale. If at the end of the list and all fallback locales failed, it must return the source string.

linr211 commented 2 years ago

How to define the list of fallback locales, could you provide an example?