mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
Add direction info
This commit is contained in:
parent
fdf6628cc5
commit
fefbdb6fe1
2 changed files with 12 additions and 1 deletions
|
@ -163,6 +163,8 @@ window.html10n = (function(window, document, undefined) {
|
||||||
MicroEvent.mixin(html10n)
|
MicroEvent.mixin(html10n)
|
||||||
|
|
||||||
html10n.macros = {}
|
html10n.macros = {}
|
||||||
|
|
||||||
|
html10n.rtl = ["ar","dv","fa","ha","he","ks","ku","ps","ur","yi"]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get rules for plural forms (shared with JetPack), see:
|
* Get rules for plural forms (shared with JetPack), see:
|
||||||
|
@ -831,6 +833,14 @@ window.html10n = (function(window, document, undefined) {
|
||||||
return this.language;
|
return this.language;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the direction of the language returned be html10n#getLanguage
|
||||||
|
*/
|
||||||
|
html10n.getDirection = function() {
|
||||||
|
var langCode = this.language.indexOf('-') == -1? this.language : this.language.substr(0, this.language.indexOf('-'))
|
||||||
|
return html10n.rtl.indexOf(langCode) == -1? 'ltr' : 'rtl'
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index all <link>s
|
* Index all <link>s
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(function(document) {
|
(function(document) {
|
||||||
// Set language for l10n
|
// Set language for l10n
|
||||||
var language = document.cookie.match(/language=(\w{2,3})(-w+)?/);
|
var language = document.cookie.match(/language=((\w{2,3})(-w+)?)/);
|
||||||
if(language) language = language[1];
|
if(language) language = language[1];
|
||||||
|
|
||||||
html10n.bind('indexed', function() {
|
html10n.bind('indexed', function() {
|
||||||
|
@ -9,5 +9,6 @@
|
||||||
|
|
||||||
html10n.bind('localized', function() {
|
html10n.bind('localized', function() {
|
||||||
document.documentElement.lang = html10n.getLanguage()
|
document.documentElement.lang = html10n.getLanguage()
|
||||||
|
document.documentElement.dir = html10n.getDirection()
|
||||||
})
|
})
|
||||||
})(document)
|
})(document)
|
Loading…
Add table
Add a link
Reference in a new issue