mirror of
https://github.com/status-im/consul.git
synced 2025-02-01 16:37:12 +00:00
d6667880d4
* Add inline-code CSS component * Add %inline-code to all the places where we need it * Inject selected env variables into the translations file * Add ingress gateway upstream 'host header' intro text * Make sure we can use actual correct component casing for titles but still have nice consistent menu item casing in the side nav
36 lines
912 B
JavaScript
36 lines
912 B
JavaScript
import IntlService from 'ember-intl/services/intl';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
class I18nService extends IntlService {
|
|
@service('env') env;
|
|
/**
|
|
* Additionally injects selected project level environment variables into the
|
|
* message formatting context for usage within translated texts
|
|
*/
|
|
formatMessage(value, formatOptions) {
|
|
const env = [
|
|
'CONSUL_HOME_URL',
|
|
'CONSUL_REPO_ISSUES_URL',
|
|
'CONSUL_DOCS_URL',
|
|
'CONSUL_DOCS_LEARN_URL',
|
|
'CONSUL_DOCS_API_URL',
|
|
'CONSUL_COPYRIGHT_URL',
|
|
].reduce((prev, key) => {
|
|
prev[key] = this.env.var(key);
|
|
return prev;
|
|
}, {});
|
|
|
|
formatOptions = {
|
|
...formatOptions,
|
|
...env,
|
|
};
|
|
return super.formatMessage(value, formatOptions);
|
|
}
|
|
}
|
|
export default {
|
|
name: 'i18n',
|
|
initialize: function(container) {
|
|
container.register('service:intl', I18nService);
|
|
},
|
|
};
|