Skip to content
Snippets Groups Projects
Commit 3343ff91 authored by Johannes Goderbauer's avatar Johannes Goderbauer Committed by Johannes Goderbauer
Browse files

Context_utils: added getTranslatedTitle-function

(cherry picked from commit 94a50d96)
parent 32b19692
No related branches found
No related tags found
No related merge requests found
......@@ -35,14 +35,29 @@ ContextUtils.getCurrentContextId = function()
* Returns the title of the context
*
* @param {String} pContextId id of the context
* @param {boolean} [pTranslate=false] if the title should be translated
* @param {boolean} [pAutoTranslate=false] pass "true" if the title should be translated with the current locale
*
* @return {String} title of the context
*/
ContextUtils.getTitle = function(pContextId, pTranslate)
ContextUtils.getTitle = function(pContextId, pAutoTranslate)
{
var title = project.getDataModel(project.DATAMODEL_KIND_CONTEXT, pContextId)[1];
return pTranslate ? translate.text(title) : title;
var dataModel = project.getDataModel(project.DATAMODEL_KIND_CONTEXT, pContextId);
var title = dataModel[1];
return pAutoTranslate ? translate.text(title) : title;
}
/**
* Returns the translated title of the context
*
* @param {String} pContextId id of the context
* @param {String} [pLocale=null] the locale for the translation, e.g. "de_DE"
*
* @return {String} title of the context, translated to the given (or default) locale
*/
ContextUtils.getTranslatedTitle = function(pContextId, pLocale)
{
var title = ContextUtils.getTitle(pContextId, false);
return pLocale ? translate.text(title, pLocale) : translate.text(title);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment