aboutsummaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-06-29 08:03:43 +0200
committerGitHub <noreply@github.com>2018-06-29 08:03:43 +0200
commit61842f66ee9d5b5ceb5ac925e5c213047d5a5e19 (patch)
treeccc8412bb3e0e3eb3fba7086ef3f3f1b23616685 /settings
parent89b6ee1a45f165346ddcc9120195714087287b47 (diff)
parentc1682f4228e29cfe9203fed63e7f203dc582482b (diff)
downloadnextcloud-server-61842f66ee9d5b5ceb5ac925e5c213047d5a5e19.tar.gz
nextcloud-server-61842f66ee9d5b5ceb5ac925e5c213047d5a5e19.zip
Merge pull request #5623 from nextcloud/locale-setting
Add user locale/region setting
Diffstat (limited to 'settings')
-rw-r--r--settings/css/settings.scss8
-rw-r--r--settings/js/settings/personalInfo.js35
-rw-r--r--settings/templates/settings/personal/personal.info.php35
3 files changed, 75 insertions, 3 deletions
diff --git a/settings/css/settings.scss b/settings/css/settings.scss
index 5742b6a5523..cfca22d5bbb 100644
--- a/settings/css/settings.scss
+++ b/settings/css/settings.scss
@@ -103,7 +103,7 @@ input {
.profile-settings-container {
display: inline-grid;
grid-template-columns: 1fr;
- grid-template-rows: 1fr 2fr 1fr;
+ grid-template-rows: 1fr 1fr 1fr 1fr;
}
.personal-show-container {
@@ -118,7 +118,8 @@ input {
select {
&#timezone,
- &#languageinput {
+ &#languageinput,
+ &#localeinput {
width: 100%;
}
}
@@ -145,7 +146,8 @@ input {
}
.personal-info {
margin-right: 10%;
- margin-bottom: 20px;
+ margin-bottom: 12px;
+ margin-top: 12px;
}
.personal-info[class^='icon-'], .personal-info[class*=' icon-'] {
background-position: 0px 2px;
diff --git a/settings/js/settings/personalInfo.js b/settings/js/settings/personalInfo.js
index 565ae4a2f5b..2f7e1c386b5 100644
--- a/settings/js/settings/personalInfo.js
+++ b/settings/js/settings/personalInfo.js
@@ -5,6 +5,7 @@
* 2013, Morris Jobke <morris.jobke@gmail.com>
* 2016, Christoph Wurst <christoph@owncloud.com>
* 2017, Arthur Schiwon <blizzz@arthur-schiwon.de>
+ * 2017, Thomas Citharel <tcit@tcit.fr>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
@@ -294,6 +295,32 @@ $(document).ready(function () {
};
$("#languageinput").change(updateLanguage);
+ var updateLocale = function () {
+ if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
+ OC.PasswordConfirmation.requirePasswordConfirmation(updateLocale);
+ return;
+ }
+
+ var selectedLocale = $("#localeinput").val(),
+ user = OC.getCurrentUser();
+
+ $.ajax({
+ url: OC.linkToOCS('cloud/users', 2) + user['uid'],
+ method: 'PUT',
+ data: {
+ key: 'locale',
+ value: selectedLocale
+ },
+ success: function() {
+ moment.locale(selectedLocale);
+ },
+ fail: function() {
+ OC.Notification.showTemporary(t('settings', 'An error occured while changing your locale. Please reload the page and try again.'));
+ }
+ });
+ };
+ $("#localeinput").change(updateLocale);
+
var uploadparms = {
pasteZone: null,
done: function (e, data) {
@@ -414,4 +441,12 @@ $(document).ready(function () {
}, user.displayName);
});
+window.setInterval(function() {
+ $('#localeexample-time').text(moment().format('LTS'));
+ $('#localeexample-date').text(moment().format('L'));
+ $('#localeexample-fdow').text(t('settings', 'Week starts on {fdow}',
+ {fdow: moment().weekday(0).format('dddd')}));
+
+}, 1000);
+
OC.Settings.updateAvatar = updateAvatar;
diff --git a/settings/templates/settings/personal/personal.info.php b/settings/templates/settings/personal/personal.info.php
index f8268e199ee..1946e3ec66e 100644
--- a/settings/templates/settings/personal/personal.info.php
+++ b/settings/templates/settings/personal/personal.info.php
@@ -3,6 +3,7 @@
* @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
*
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ * @author Thomas Citharel <tcit@tcit.fr>
*
* @license GNU AGPL version 3 or any later version
*
@@ -341,6 +342,40 @@ vendor_style('jcrop/css/jquery.Jcrop');
</form>
<?php } ?>
</div>
+ <div class="personal-settings-setting-box personal-settings-locale-box">
+ <?php if (isset($_['activelocale'])) { ?>
+ <form id="locale" class="section">
+ <h2>
+ <label for="localeinput"><?php p($l->t('Locale'));?></label>
+ </h2>
+ <select id="localeinput" name="lang" data-placeholder="<?php p($l->t('Locale'));?>">
+ <option value="<?php p($_['activelocale']['code']);?>">
+ <?php p($_['activelocale']['name']);?>
+ </option>
+ <optgroup label="––––––––––"></optgroup>
+ <?php foreach($_['localesForLanguage'] as $locale):?>
+ <option value="<?php p($locale['code']);?>">
+ <?php p($locale['name']);?>
+ </option>
+ <?php endforeach;?>
+ <optgroup label="––––––––––"></optgroup>
+ <option value="<?php p($_['activelocale']['code']);?>">
+ <?php p($_['activelocale']['name']);?>
+ </option>
+ <?php foreach($_['locales'] as $locale):?>
+ <option value="<?php p($locale['code']);?>">
+ <?php p($locale['name']);?>
+ </option>
+ <?php endforeach;?>
+ </select>
+ <div id="localeexample" class="personal-info icon-timezone">
+ <p id="localeexample-time"></p>
+ <p id="localeexample-date"></p>
+ <p id="localeexample-fdow"></p>
+ </div>
+ </form>
+ <?php } ?>
+ </div>
<div class="personal-settings-setting-box personal-settings-password-box">
<?php
if($_['passwordChangeSupported']) {