Using web browsers locale in the extension mode

This commit is contained in:
Yury Delendik 2012-05-01 20:37:03 -05:00
parent e7f63e3e5e
commit 32e9eb35fe
3 changed files with 14 additions and 2 deletions

View File

@ -58,6 +58,9 @@ ChromeActions.prototype = {
return '{}';
return application.prefs.getValue(EXT_PREFIX + '.database', '{}');
},
getLocale: function() {
return application.prefs.getValue('general.useragent.locale', 'en-US');
},
pdfBugEnabled: function() {
return application.prefs.getValue(EXT_PREFIX + '.pdfBugEnabled', false);
}

View File

@ -18,7 +18,11 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
/*
Additional modifications for PDF.js project:
- Loading resources from <script type='application/l10n'>;
- Disabling language assignment on page loading.
*/
'use strict';
(function(window) {
@ -271,6 +275,7 @@
gLanguage = '';
}
/*
// load the default locale on startup
window.addEventListener('DOMContentLoaded', function() {
var lang = navigator.language;
@ -286,6 +291,7 @@
loadLocale(lang, translateFragment);
}
});
*/
// Public API
document.mozL10n = {

View File

@ -1347,8 +1347,11 @@ window.addEventListener('load', function webViewerLoad(evt) {
if ('disableWorker' in hashParams)
PDFJS.disableWorker = (hashParams['disableWorker'] === 'true');
var locale = !PDFJS.isFirefoxExtension ? navigator.language :
FirefoxCom.request('getLocale', null);
if ('locale' in hashParams)
mozL10n.language.code = hashParams['locale'];
locale = hashParams['locale'];
mozL10n.language.code = locale;
if ('disableTextLayer' in hashParams)
PDFJS.disableTextLayer = (hashParams['disableTextLayer'] === 'true');