зеркало из https://github.com/mozilla/buddyup.git
Merge pull request #192 from mythmon/locale-questions-1209472
[Bug 1209472] Set the locale of newly created accounts based on device locale
This commit is contained in:
Коммит
59489cbd39
|
@ -42,6 +42,7 @@
|
|||
<script src="js/libs/font_size_utils.js"></script>
|
||||
<script src="js/loader.js"></script>
|
||||
|
||||
<script src="js/mobile_operator.js"></script>
|
||||
<script src="js/utils.js"></script>
|
||||
<script src="js/sumo_db.js"></script>
|
||||
<script src="js/error_controller.js"></script>
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
<script src="js/load_translations.js"></script>
|
||||
<script src="js/libs/font_size_utils.js"></script>
|
||||
<script src="js/mobile_operator.js"></script>
|
||||
<script src="js/utils.js"></script>
|
||||
<script src="js/libs/nunjucks-slim.js"></script>
|
||||
<script src="js/templates.js"></script>
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
<script src="js/libs/font_size_utils.js"></script>
|
||||
<script src="js/loader.js"></script>
|
||||
|
||||
<script src="js/mobile_operator.js"></script>
|
||||
<script src="js/utils.js"></script>
|
||||
<script src="js/sumo_db.js"></script>
|
||||
<script src="js/error_controller.js"></script>
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<script src="js/libs/font_size_utils.js"></script>
|
||||
<script src="js/loader.js"></script>
|
||||
|
||||
<script src="js/mobile_operator.js"></script>
|
||||
<script src="js/utils.js"></script>
|
||||
<script src="js/sumo_db.js"></script>
|
||||
<script src="js/error_controller.js"></script>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<script src="js/load_translations.js"></script>
|
||||
<script src="js/libs/l10n.js"></script>
|
||||
<script src="js/settings.js"></script>
|
||||
<script src="js/mobile_operator.js"></script>
|
||||
<script src="js/utils.js"></script>
|
||||
<script src="js/libs/lodash.custom.min.js"></script>
|
||||
<script src="js/libs/async_storage.js"></script>
|
||||
|
|
|
@ -305,7 +305,8 @@
|
|||
var data = {
|
||||
username: username,
|
||||
password: password,
|
||||
email: email
|
||||
email: email,
|
||||
locale: Utils.get_supported_device_language(),
|
||||
};
|
||||
return request(endpoint, 'POST', data).then(JSON.parse);
|
||||
},
|
||||
|
|
|
@ -55,11 +55,16 @@
|
|||
});
|
||||
}
|
||||
|
||||
var _create_user_promise = null;
|
||||
/**
|
||||
* Create and store new user.
|
||||
*/
|
||||
function create_user() {
|
||||
return SumoDB.create_user().then(function(response) {
|
||||
if (_create_user_promise !== null) {
|
||||
return _create_user_promise;
|
||||
}
|
||||
|
||||
return _create_user_promise = SumoDB.create_user().then(function(response) {
|
||||
var promises = [];
|
||||
|
||||
var is_helper = false;
|
||||
|
@ -68,7 +73,17 @@
|
|||
|
||||
promises.push(sync_user(response.user));
|
||||
|
||||
return Promise.all(promises).then(function([credentials, user]) {
|
||||
// If the device is using a supported locale, set the profile of
|
||||
// the created user to use that locale.
|
||||
promises.push(User.update_user({
|
||||
user: {
|
||||
username: response.user.username,
|
||||
locale: Utils.get_supported_device_language(),
|
||||
},
|
||||
settings: {},
|
||||
}));
|
||||
|
||||
return Promise.all(promises).then(function([credentials, outdated_user, user]) {
|
||||
return user;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -248,6 +248,16 @@
|
|||
});
|
||||
|
||||
return deferred;
|
||||
},
|
||||
|
||||
get_supported_device_language() {
|
||||
var user_meta = Utils.get_user_meta();
|
||||
for (var i = 0; i < Settings.LOCALES.length; i++) {
|
||||
if (Settings.LOCALES[i][0] == user_meta.lang) {
|
||||
return user_meta.lang;
|
||||
}
|
||||
}
|
||||
return Settings.LOCALES[0][0];
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
<script src="js/libs/font_size_utils.js"></script>
|
||||
<script src="js/settings.js"></script>
|
||||
<script src="js/loader.js"></script>
|
||||
<script src="js/mobile_operator.js"></script>
|
||||
<script src="js/utils.js"></script>
|
||||
<script src="js/loading_indicator.js"></script>
|
||||
<script src="js/kb_controller.js"></script>
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<script src="js/libs/font_size_utils.js"></script>
|
||||
<script src="js/loader.js"></script>
|
||||
|
||||
<script src="js/mobile_operator.js"></script>
|
||||
<script src="js/utils.js"></script>
|
||||
<script src="js/sumo_db.js"></script>
|
||||
<script src="js/error_controller.js"></script>
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<script src="js/libs/font_size_utils.js"></script>
|
||||
<script src="js/loader.js"></script>
|
||||
|
||||
<script src="js/mobile_operator.js"></script>
|
||||
<script src="js/utils.js"></script>
|
||||
<script src="js/sumo_db.js"></script>
|
||||
<script src="js/error_controller.js"></script>
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
<script src="js/libs/font_size_utils.js"></script>
|
||||
<script src="js/loader.js"></script>
|
||||
|
||||
<script src="js/mobile_operator.js"></script>
|
||||
<script src="js/utils.js"></script>
|
||||
<script src="js/user.js"></script>
|
||||
<script src="js/sumo_db.js"></script>
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<script src="js/libs/font_size_utils.js"></script>
|
||||
<script src="js/loader.js"></script>
|
||||
|
||||
<script src="js/mobile_operator.js"></script>
|
||||
<script src="js/utils.js"></script>
|
||||
<script src="js/user.js"></script>
|
||||
<script src="js/sumo_db.js"></script>
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<script src="js/libs/font_size_utils.js"></script>
|
||||
<script src="js/loader.js"></script>
|
||||
|
||||
<script src="js/mobile_operator.js"></script>
|
||||
<script src="js/utils.js"></script>
|
||||
<script src="js/sumo_db.js"></script>
|
||||
<script src="js/error_controller.js"></script>
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
<script src="js/nunjucks_env.js"></script>
|
||||
<script src="js/l10n.js"></script>
|
||||
<script src="js/libs/font_size_utils.js"></script>
|
||||
<script src="js/mobile_operator.js"></script>
|
||||
<script src="js/utils.js"></script>
|
||||
<script src="js/loader.js"></script>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче