Move OC.L10n to the server bundle

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2019-01-29 09:28:45 +01:00
parent 3695d02575
commit d0cd0918b9
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
7 changed files with 44 additions and 36 deletions

View File

@ -9,7 +9,6 @@
"jquery.ocdialog.js", "jquery.ocdialog.js",
"oc-dialogs.js", "oc-dialogs.js",
"js.js", "js.js",
"l10n.js",
"share.js", "share.js",
"sharetemplates.js", "sharetemplates.js",
"sharesocialmanager.js", "sharesocialmanager.js",

18
core/js/dist/main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,6 @@
"jquery.ocdialog.js", "jquery.ocdialog.js",
"oc-dialogs.js", "oc-dialogs.js",
"js.js", "js.js",
"l10n.js",
"octemplate.js", "octemplate.js",
"public/appconfig.js", "public/appconfig.js",
"public/comments.js", "public/comments.js",

View File

@ -25,6 +25,7 @@ import Apps from './apps'
import AppConfig from './appconfig' import AppConfig from './appconfig'
import ContactsMenu from './contactsmenu'; import ContactsMenu from './contactsmenu';
import EventSource from './eventsource' import EventSource from './eventsource'
import L10N from './l10n'
import {davCall, davSync} from './backbone-webdav'; import {davCall, davSync} from './backbone-webdav';
// Patch Backbone for DAV // Patch Backbone for DAV
@ -38,6 +39,7 @@ export default {
Apps, Apps,
AppConfig, AppConfig,
Backbone, Backbone,
EventSource,
ContactsMenu, ContactsMenu,
EventSource,
L10N,
}; };

View File

@ -8,12 +8,18 @@
* *
*/ */
import _ from 'underscore'
import $ from 'jquery'
import Handlebars from 'handlebars'
import OC from './index'
/** /**
* L10N namespace with localization functions. * L10N namespace with localization functions.
* *
* @namespace * @namespace OC.L10n
*/ */
OC.L10N = { const L10n = {
/** /**
* String bundles with app name as key. * String bundles with app name as key.
* @type {Object.<String,String>} * @type {Object.<String,String>}
@ -321,28 +327,9 @@ OC.L10N = {
} }
}; };
/** export default L10n;
* translate a string
* @param {string} app the id of the app for which to translate the string
* @param {string} text the string to translate
* @param [vars] map of placeholder key to value
* @param {number} [count] number to replace %n with
* @return {string}
*/
window.t = _.bind(OC.L10N.translate, OC.L10N);
/**
* translate a string
* @param {string} app the id of the app for which to translate the string
* @param {string} text_singular the string to translate for exactly one object
* @param {string} text_plural the string to translate for n objects
* @param {number} count number to determine whether to use singular or plural
* @param [vars] map of placeholder key to value
* @return {string} Translated string
*/
window.n = _.bind(OC.L10N.translatePlural, OC.L10N);
Handlebars.registerHelper('t', function(app, text) { Handlebars.registerHelper('t', function(app, text) {
return OC.L10N.translate(app, text); return L10n.translate(app, text);
}); });

View File

@ -72,3 +72,24 @@ window['moment'] = moment
window['OC'] = OC window['OC'] = OC
window['OCP'] = OCP window['OCP'] = OCP
window['OCA'] = OCA window['OCA'] = OCA
/**
* translate a string
* @param {string} app the id of the app for which to translate the string
* @param {string} text the string to translate
* @param [vars] map of placeholder key to value
* @param {number} [count] number to replace %n with
* @return {string}
*/
window.t = _.bind(OC.L10N.translate, OC.L10N);
/**
* translate a string
* @param {string} app the id of the app for which to translate the string
* @param {string} text_singular the string to translate for exactly one object
* @param {string} text_plural the string to translate for n objects
* @param {number} count number to determine whether to use singular or plural
* @param [vars] map of placeholder key to value
* @return {string} Translated string
*/
window.n = _.bind(OC.L10N.translatePlural, OC.L10N);