Add pad setting for UI lang
parent
fb340793da
commit
7021a8b885
|
@ -34,6 +34,7 @@ pad.settings.linenocheck = Zeilennummern
|
|||
pad.settings.fontType = Schriftart:
|
||||
pad.settings.fontType.normal = Normal
|
||||
pad.settings.fontType.monospaced = Monospace
|
||||
pad.settings.language = Sprache
|
||||
pad.settings.globalView = Eigene Ansicht
|
||||
|
||||
pad.importExport.import_export = Import/Export
|
||||
|
|
|
@ -2,19 +2,23 @@ var Globalize = require('globalize')
|
|||
, fs = require('fs')
|
||||
, path = require('path')
|
||||
|
||||
exports.availableLangs = {}
|
||||
fs.readdir(__dirname+"/../../locales", function(er, files) {
|
||||
files.forEach(function(locale) {
|
||||
locale = locale.split('.')[0]
|
||||
if(locale.toLowerCase() == 'en') return;
|
||||
|
||||
require('globalize/lib/cultures/globalize.culture.'+locale+'.js')
|
||||
var culture = Globalize.cultures[locale];
|
||||
exports.availableLangs[culture.name] = culture.nativeName;
|
||||
})
|
||||
})
|
||||
|
||||
exports.expressCreateServer = function(n, args) {
|
||||
|
||||
args.app.get('/locale.ini', function(req, res) {
|
||||
|
||||
Globalize.culture( req.header('Accept-Language') || 'en' );
|
||||
// let gloablize find out the preferred locale and default to 'en'
|
||||
Globalize.culture(req.cookies['language'] || req.header('Accept-Language') || 'en');
|
||||
var localePath = path.normalize(__dirname +"/../../locales/"+Globalize.culture().name+".ini");
|
||||
res.sendfile(localePath, function(er) {
|
||||
if(er) console.error(er)
|
||||
|
|
|
@ -447,6 +447,7 @@ var pad = {
|
|||
{
|
||||
pad.collabClient.sendClientMessage(msg);
|
||||
},
|
||||
createCookie: createCookie,
|
||||
|
||||
init: function()
|
||||
{
|
||||
|
|
|
@ -75,6 +75,11 @@ var padeditor = (function()
|
|||
{
|
||||
pad.changeViewOption('useMonospaceFont', $("#viewfontmenu").val() == 'monospace');
|
||||
});
|
||||
$("#languagemenu").val(document.webL10n.getLanguage());
|
||||
$("#languagemenu").change(function() {
|
||||
pad.createCookie("language",$("#languagemenu").val(),null,'/');
|
||||
document.webL10n.setLanguage($("#languagemenu").val());
|
||||
});
|
||||
},
|
||||
setViewOptions: function(newOptions)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<%
|
||||
var settings = require("ep_etherpad-lite/node/utils/Settings");
|
||||
var settings = require("ep_etherpad-lite/node/utils/Settings")
|
||||
, langs = require("ep_etherpad-lite/node/hooks/i18n").availableLangs
|
||||
%>
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
@ -207,6 +208,15 @@
|
|||
<option value="monospace" data-l10n-id="pad.settings.fontType.monospaced">Monospaced</option>
|
||||
</select>
|
||||
</p>
|
||||
<p data-l10n-id="pad.settings.language">
|
||||
Language:
|
||||
<select id="languagemenu">
|
||||
<option value="en">English</option>
|
||||
<% for (lang in langs) { %>
|
||||
<option value="<%=lang%>"><%=langs[lang]%></option>
|
||||
<% } %>
|
||||
</select>
|
||||
</p>
|
||||
<% e.end_block(); %>
|
||||
</div>
|
||||
<div class="column">
|
||||
|
|
Loading…
Reference in New Issue