mirror of https://github.com/rancher/ui.git
Fix shift-L for toggling language
This commit is contained in:
parent
5a5424f5e7
commit
fd2f55f60b
|
|
@ -145,7 +145,7 @@ export default Ember.Component.extend(NewOrEdit, SelectTab, {
|
|||
});
|
||||
|
||||
return out;
|
||||
}.property('service.name','service.secondaryLaunchConfigs.@each.name','intl._locale'),
|
||||
}.property('service.name','service.secondaryLaunchConfigs.@each.name','intl.locale'),
|
||||
|
||||
noLaunchConfigsEnabled: function() {
|
||||
return this.get('launchConfigChoices').filterBy('enabled',true).get('length') === 0;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ export default Ember.Component.extend(HoverDropdown, {
|
|||
currentPath : null,
|
||||
|
||||
// Injections
|
||||
intl : Ember.inject.service(),
|
||||
projects : Ember.inject.service(),
|
||||
project : Ember.computed.alias('projects.current'),
|
||||
projectId : Ember.computed.alias(`tab-session.${C.TABSESSION.PROJECT}`),
|
||||
|
|
@ -53,6 +54,7 @@ export default Ember.Component.extend(HoverDropdown, {
|
|||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.get('intl.locale');
|
||||
this.set('stacks', this.get('store').all('stack'));
|
||||
this.set('hosts', this.get('store').all('host'));
|
||||
this.set('stackSchema', this.get('store').getById('schema','stack'));
|
||||
|
|
@ -114,7 +116,8 @@ export default Ember.Component.extend(HoverDropdown, {
|
|||
'stacks.@each.group',
|
||||
`prefs.${C.PREFS.ACCESS_WARNING}`,
|
||||
'access.enabled',
|
||||
'isAdmin'
|
||||
'isAdmin',
|
||||
'intl.locale'
|
||||
),
|
||||
|
||||
// Utilities you can use in the condition() function to decide if an item is shown or hidden,
|
||||
|
|
|
|||
|
|
@ -3,23 +3,26 @@ import missingMessage from 'ui/utils/intl/missing-message';
|
|||
const { get, makeArray } = Ember;
|
||||
|
||||
export function initialize(instance) {
|
||||
var intl = instance.lookup('service:intl');
|
||||
let intl = instance.lookup('service:intl');
|
||||
let adapter = intl.get('adapter');
|
||||
|
||||
intl.reopen({
|
||||
// calling findTranslationByKey with a null key explodes, make it return something
|
||||
_findTranslationByKey: intl.findTranslationByKey,
|
||||
findTranslationByKey(key, locales) {
|
||||
locales = makeArray(locales || get(this, '_locale'));
|
||||
adapter.reopen({
|
||||
_lookup: adapter.lookup,
|
||||
lookup(locales, key) {
|
||||
locales = makeArray(locales || get(this, 'locale'));
|
||||
|
||||
if (locales[0] === 'none') {
|
||||
return missingMessage(key, locales);
|
||||
} else if ( key ) {
|
||||
return this._findTranslationByKey(...arguments);
|
||||
return this._lookup(locales, key);
|
||||
}else {
|
||||
return this._findTranslationByKey('generic.missing', locales);
|
||||
return this._lookup(locales, 'generic.missing');
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// @TODO use regular t with htmlSafe instead
|
||||
intl.reopen({
|
||||
tHtml(key, ...args) {
|
||||
const [ options ] = args;
|
||||
const translation = this.findTranslationByKey(key, options && options.locale);
|
||||
|
|
|
|||
Loading…
Reference in New Issue