strong-globalize is built on Unicode CLDR and jquery/globalize and implements automatic extraction of strings from JS source code and HTML templates, lint the string resource, machine-translate them in seconds. In runtime, it loads locale and string resource into memory and provides a hook to persistent logging.
Other
25
stars
16
forks
source link
g.http() does not default to English for unsupported languages #166
Issue: g.http() does not default to English for unsupported languages
Bringing up another issue that was found with the g.http() function.
var g = require('strong-globalize')();
let req = {
headers: {
'accept-language': 'id' // Language not supported
}
}
g.http(req).log('Hello'); // prints out ' ah-hoy' (This language is in Czech. It does NOT default to English
This occurs only in the http() function due to the accept-language module here https://github.com/strongloop/strong-globalize/blob/master/packages/runtime/src/helper.ts#L883-L884. This is because the accept-language module uses the first language in the appLanguages array as the default language. In order for g.http() to choose the default language correctly, a simple solution can be implemented where the default language is added to the front of the language list.
An argument can be made that the accept-language module should be responsible for allowing a defaultLanguage to be selected. However, it seems that the accept-language module is not being updated anymore. (I opened an issue with them a few months back https://github.com/tinganho/node-accept-language/issues/36)
Issue: g.http() does not default to English for unsupported languages
Bringing up another issue that was found with the g.http() function.
This occurs only in the http() function due to the accept-language module here https://github.com/strongloop/strong-globalize/blob/master/packages/runtime/src/helper.ts#L883-L884. This is because the accept-language module uses the first language in the appLanguages array as the default language. In order for g.http() to choose the default language correctly, a simple solution can be implemented where the default language is added to the front of the language list.
An argument can be made that the
accept-language
module should be responsible for allowing a defaultLanguage to be selected. However, it seems that the accept-language module is not being updated anymore. (I opened an issue with them a few months back https://github.com/tinganho/node-accept-language/issues/36)