Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Bug 1000130 - Clean up bootstrap mozL10n API use in Gallery. r=djf
Browse files Browse the repository at this point in the history
  • Loading branch information
stasm committed Jun 4, 2014
1 parent 3dab103 commit d02cf4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion apps/gallery/js/frames.js
Expand Up @@ -286,7 +286,7 @@ function swipeHandler(event) {
var direction = (frameOffset < 0) ? 1 : -1;

// If we're in a right-to-left locale, reverse those directions
if (languageDirection === 'rtl')
if (navigator.mozL10n.language.direction === 'rtl')
direction *= -1;

// Did we pan far enough or swipe fast enough to transition to
Expand Down
18 changes: 4 additions & 14 deletions apps/gallery/js/gallery.js
Expand Up @@ -68,9 +68,6 @@ const LAYOUT_MODE = {

var currentView;

// This will be set to "ltr" or "rtl" when we get our localized event
var languageDirection;

// Register orientation watcher in ScreenLayout
ScreenLayout.watch('portrait', '(orientation: portrait)');
var isPortrait = ScreenLayout.getCurrentLayout('portrait');
Expand Down Expand Up @@ -122,13 +119,8 @@ var lastFocusedThumbnail = null;

var currentOverlay; // The id of the current overlay or null if none.

// The localized event is the main entry point for the app.
// We don't do anything until we receive it.
navigator.mozL10n.ready(function showBody() {
// Set the 'lang' and 'dir' attributes to <html> when the page is translated
document.documentElement.lang = navigator.mozL10n.language.code;
document.documentElement.dir = navigator.mozL10n.language.direction;

// mozL10n.once is the main entry point for the app.
navigator.mozL10n.once(function showBody() {
// <body> children are hidden until the UI is translated
document.body.classList.remove('hidden');

Expand All @@ -137,10 +129,8 @@ navigator.mozL10n.ready(function showBody() {
loader.load('js/frame_scripts.js');
}

// Now initialize the rest of the app. But don't re-initialize if the user
// switches languages when the app is already running
if (!photodb)
init();
// Now initialize the rest of the app.
init();
});

function init() {
Expand Down
2 changes: 1 addition & 1 deletion apps/gallery/js/open.js
@@ -1,4 +1,4 @@
window.addEventListener('localized', function() {
navigator.mozL10n.once(function() {
var activity; // The activity object we're handling
var activityData; // The data sent by the initiating app
var blob; // The blob we'll be displaying and maybe saving
Expand Down

0 comments on commit d02cf4c

Please sign in to comment.