category_tree::get_translation (public)
category_tree::get_translation tree_id [ locale ]
Defined in packages/categories/tcl/category-trees-procs.tcl
Gets the category tree name and description in the given language, if available. Uses the default language otherwise.
- Parameters:
- tree_id (required)
- category tree to get the name and description of.
- locale (optional)
- language in which to get the name and description. [ad_conn locale] used by default.
- Returns:
- tcl-list: name description
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_tree_import, category_crud
Source code: if {[nsv_names category_tree_translations] eq "" || ![nsv_exists category_tree_translations $tree_id]} { return [list] } set default_locale [parameter::get -parameter DefaultLocale -default en_US] if {$locale eq ""} { set locale [expr {[ns_conn isconnected] ? [ad_conn locale] : $default_locale}] } set tree_lang [nsv_get category_tree_translations $tree_id] if {[dict exists $tree_lang $locale]} { # exact match: found name for this locale set names [dict get $tree_lang $locale] } elseif {[dict exists $tree_lang $default_locale]} { # default locale found set names [dict get $tree_lang $default_locale] } else { # tried default locale, but nothing found set names "" } return $namesXQL Not present: Generic PostgreSQL XQL file: packages/categories/tcl/category-trees-procs-postgresql.xql
Oracle XQL file: packages/categories/tcl/category-trees-procs-oracle.xql