OC.getLocale() now returns Locale and no longer Language
Added OC.getLanguage() to get Language <html lang=''> still gets language, though according to IETF BCP47 locale should be good. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
7d8124ad66
commit
bf6bfad76b
|
@ -791,6 +791,15 @@ var OCP = {},
|
||||||
* @return {String} locale string
|
* @return {String} locale string
|
||||||
*/
|
*/
|
||||||
getLocale: function() {
|
getLocale: function() {
|
||||||
|
return $('html').prop('data-locale');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the user's language
|
||||||
|
*
|
||||||
|
* @returns {String} language string
|
||||||
|
*/
|
||||||
|
getLanguage: function () {
|
||||||
return $('html').prop('lang');
|
return $('html').prop('lang');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="ng-csp" data-placeholder-focus="false" lang="<?php p($_['language']); ?>" >
|
<html class="ng-csp" data-placeholder-focus="false" lang="<?php p($_['language']); ?>" data-locale="<?php p($_['locale']); ?>" >
|
||||||
<head data-user="<?php p($_['user_uid']); ?>" data-user-displayname="<?php p($_['user_displayname']); ?>" data-requesttoken="<?php p($_['requesttoken']); ?>">
|
<head data-user="<?php p($_['user_uid']); ?>" data-user-displayname="<?php p($_['user_displayname']); ?>" data-requesttoken="<?php p($_['requesttoken']); ?>">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>
|
<title>
|
||||||
|
|
|
@ -195,7 +195,7 @@ class Factory implements IFactory {
|
||||||
return 'en';
|
return 'en';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findLocale($app = null, $lang = null)
|
public function findLocale($lang = null)
|
||||||
{
|
{
|
||||||
if ($this->config->getSystemValue('installed', false)) {
|
if ($this->config->getSystemValue('installed', false)) {
|
||||||
$userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() : null;
|
$userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() : null;
|
||||||
|
|
|
@ -131,10 +131,11 @@ class TemplateLayout extends \OC_Template {
|
||||||
parent::__construct('core', 'layout.base');
|
parent::__construct('core', 'layout.base');
|
||||||
|
|
||||||
}
|
}
|
||||||
// Send the language to our layouts
|
// Send the language and the locale to our layouts
|
||||||
$lang = \OC::$server->getL10NFactory()->findLanguage();
|
$lang = \OC::$server->getL10NFactory()->findLanguage();
|
||||||
$lang = str_replace('_', '-', $lang);
|
$lang = str_replace('_', '-', $lang);
|
||||||
$this->assign('language', $lang);
|
$this->assign('language', $lang);
|
||||||
|
$this->assign('locale', \OC::$server->getL10NFactory()->findLocale());
|
||||||
|
|
||||||
if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
|
if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
|
||||||
if (empty(self::$versionHash)) {
|
if (empty(self::$versionHash)) {
|
||||||
|
|
Loading…
Reference in New Issue