diff options
author | Rob Garrison <wowmotty@gmail.com> | 2015-10-11 21:57:04 +0300 |
---|---|---|
committer | Rob Garrison <wowmotty@gmail.com> | 2015-10-11 21:57:04 +0300 |
commit | 18bb628ab61b5eb3bb07c0fec6af913e9bb7cb14 (patch) | |
tree | 919dd3e1856d03a51f291b8815bc36269a4c9d40 /src/chrome/popup.js | |
parent | 01b91756b0e838144176351d2b0484d5ee3ef88e (diff) |
Update missing locale string; fix button overflow issues
Diffstat (limited to 'src/chrome/popup.js')
-rw-r--r-- | src/chrome/popup.js | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/chrome/popup.js b/src/chrome/popup.js index a0d86cb..37b6976 100644 --- a/src/chrome/popup.js +++ b/src/chrome/popup.js @@ -53,8 +53,7 @@ var commands = { table = document.querySelector( '#/* @echo keyboard */' ), mode = table.style.display === 'none'; table.style.display = mode ? '' : 'none'; - this.innerHTML = ( mode ? 'Hide' : 'View' ) + ' Keyboard Commands'; - + this.innerHTML = chrome.i18n.getMessage( mode ? 'hideKeyboardCommands' : 'viewKeyboardCommands' ); }, undo : function() { chrome.tabs.executeScript( null, { @@ -63,19 +62,19 @@ var commands = { }, setLanguage : function(){ // update all text content - commands.getMsg( document.querySelectorAll( '[i18n-text]' ), true ); - commands.getMsg( document.querySelectorAll( '[i18n-title]' ), false ); + commands.getMsg( document.querySelectorAll( '[i18n-text]' ), 'text' ); + commands.getMsg( document.querySelectorAll( '[i18n-title]' ), 'title' ); }, - getMsg : function( elms, isText ) { + getMsg : function( elms, target ) { var indx, msgKey, message, len = elms.length; for ( indx = 0; indx < len; indx++ ) { - msgKey = elms[ indx ].getAttribute( 'i18n-' + ( isText ? 'text' : 'title' ) ); + msgKey = elms[ indx ].getAttribute( 'i18n-' + target ); message = chrome.i18n.getMessage( msgKey ); - if ( isText ) { - elms[ indx ].innerHTML = message; + if ( target === 'text' ) { + elms[ indx ].innerHTML += message; } else { - elms[ indx ].title = message; + elms[ indx ].title = message.replace( '<br>', ' ' ); } } } |