Include core translations

Moved search result type translations to search.js

Load JS translations earlier

Translations need to be loaded earlier to make sure that some JS files
like search.js get access to translations at this time.

This requires the template initialization to be moved to after session
initialization, because only after the session we have access to the
current language.
This commit is contained in:
Vincent Petry 2014-10-24 12:50:54 +02:00 committed by Thomas Müller
parent a589d61b78
commit d71cd680dd
3 changed files with 20 additions and 11 deletions

View File

@ -468,15 +468,6 @@ OC.search.customResults={};
OC.search.currentResult=-1; OC.search.currentResult=-1;
OC.search.lastQuery=''; OC.search.lastQuery='';
OC.search.lastResults={}; OC.search.lastResults={};
//translations for result type ids, can be extended by apps
// FIXME: move to later in the init process, after translations were loaded
OC.search.resultTypes={
file: 'File', //t('core','File'),
folder: 'Folder', //t('core','Folder'),
image: 'Image', //t('core','Image'),
audio: 'Audio' //t('core','Audio')
};
OC.addStyle.loaded=[]; OC.addStyle.loaded=[];
OC.addScript.loaded=[]; OC.addScript.loaded=[];

View File

@ -339,6 +339,7 @@ class OC {
OC_Util::addScript("oc-dialogs"); OC_Util::addScript("oc-dialogs");
OC_Util::addScript("js"); OC_Util::addScript("js");
OC_Util::addScript("l10n"); OC_Util::addScript("l10n");
OC_Util::addTranslations("core");
OC_Util::addScript("octemplate"); OC_Util::addScript("octemplate");
OC_Util::addScript("eventsource"); OC_Util::addScript("eventsource");
OC_Util::addScript("config"); OC_Util::addScript("config");
@ -526,7 +527,6 @@ class OC {
stream_wrapper_register('oc', 'OC\Files\Stream\OC'); stream_wrapper_register('oc', 'OC\Files\Stream\OC');
\OC::$server->getEventLogger()->start('init_session', 'Initialize session'); \OC::$server->getEventLogger()->start('init_session', 'Initialize session');
self::initTemplateEngine();
OC_App::loadApps(array('session')); OC_App::loadApps(array('session'));
if (self::$CLI) { if (self::$CLI) {
self::$session = new \OC\Session\Memory(''); self::$session = new \OC\Session\Memory('');
@ -534,6 +534,7 @@ class OC {
self::initSession(); self::initSession();
} }
\OC::$server->getEventLogger()->end('init_session'); \OC::$server->getEventLogger()->end('init_session');
self::initTemplateEngine();
self::checkConfig(); self::checkConfig();
self::checkInstalled(); self::checkInstalled();
self::checkSSL(); self::checkSSL();

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 2014
*
* This file is licensed under the Affero General Public License version 3
* or later.
*
* See the COPYING-README file.
*
*/
//translations for result type ids, can be extended by apps
OC.search.resultTypes={
file: t('core','File'),
folder: t('core','Folder'),
image: t('core','Image'),
audio: t('core','Audio')
};
OC.search.catagorizeResults=function(results){ OC.search.catagorizeResults=function(results){
var types={}; var types={};
for(var i=0;i<results.length;i++){ for(var i=0;i<results.length;i++){