diff --git a/process/Context_lib/process.js b/process/Context_lib/process.js index 1b910f2e34de1d8fb86377783028ebb0a25f17a3..f70649273f22841c2b5f0fa804970b9393658a53 100644 --- a/process/Context_lib/process.js +++ b/process/Context_lib/process.js @@ -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); } /**