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

some Keyword-functions: locale-param added

parent aa12fbd1
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,7 @@ KeywordUtils.getResolvedTitleSqlPart = function(pContainerName, pDbFieldName, pL
* <br/>if the key could not be found an empty string "" is returned
* @param {String} keywordContainer specifies the type of the keyword and therefore the list elements; e.g. "COUNTRY"
* @param {String} key id value of the keyword where the view-value shall be searched
* @param {String} [locale] Language-value for translations
* @param {String} [locale=locale depending on current client/servercontext] Language-value for translations
* @return {String} representation of the translated name of the keyword-key
* @example
* var histMedium;
......@@ -153,16 +153,17 @@ KeywordUtils.getContainerNames = function()
* usefull for lists where the key is the name which is then a editable displayValue
*
* @param {String} pContainerName name of the keyword container for filtering
* @param {String} [pLocale=locale depending on current client/servercontext] Language-value for translations
*
* @return {String[]} translated titles as 1D-Array
*/
KeywordUtils.getEntryNamesByContainer = function(pContainerName)
KeywordUtils.getEntryNamesByContainer = function(pContainerName, pLocale)
{
var sql = SqlCondition.begin()
.andPrepare("AB_KEYWORD_ENTRY.CONTAINER", pContainerName)
.buildSql("select AB_KEYWORD_ENTRY.TITLE from AB_KEYWORD_ENTRY", null, "order by AB_KEYWORD_ENTRY.SORTING asc, AB_KEYWORD_ENTRY.TITLE asc")
var list = db.array(db.COLUMN, sql).map(function (v){
return translate.text(v);
return pLocale ? translate.text(v, pLocale) : translate.text(v);
});
return list;
};
......@@ -173,19 +174,20 @@ KeywordUtils.getEntryNamesByContainer = function(pContainerName)
* usefull for lists where the key is the name which is then a editable displayValue
*
* @param {String} pContainerName name of the keyword container for filtering
* * @param {String} [pLocale=locale depending on current client/servercontext] Language-value for translations
*
* @return {String[]} translated titles as 1D-Array
* @return {String[]} 2D-Array in the form of [[id1, translatedTitle1], [idN, translatedTitleN]]
*/
KeywordUtils.getEntryNamesAndIdsByContainer = function(pContainerName)
KeywordUtils.getEntryNamesAndIdsByContainer = function(pContainerName, pLocale)
{
var sql = SqlCondition.begin()
.andPrepare("AB_KEYWORD_ENTRY.CONTAINER", pContainerName)
.buildSql("select AB_KEYWORD_ENTRY.AB_KEYWORD_ENTRYID, AB_KEYWORD_ENTRY.TITLE from AB_KEYWORD_ENTRY", null, "order by AB_KEYWORD_ENTRY.SORTING asc, AB_KEYWORD_ENTRY.TITLE asc")
var list = db.table(sql);
for(var i = 0; i<list.length; i = i + 1)
list[i][1] = translate.text(list[i][1]);
var list = db.table(sql).map(function (elem){
elem[1] = pLocale ? translate.text(elem[1], pLocale) : translate.text(elem[1]);
return elem;
});
return list;
};
......@@ -295,7 +297,7 @@ LanguageKeywordUtils.getResolvedTitleSqlPart = function(pDbFieldName, pLocale)
* returns a specific name (translated) - this is normally the view-value of a language
*
* @param {String} key id value of the language where the view-value shall be searched
* @param {String} [locale] Language-value for translations
* @param {String} [locale=locale depending on current client/servercontext] Language-value for translations
*
* @return {String} representation of the translated name
*
......
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