category::get_name (public)
category::get_name category_id [ locale ]
Defined in packages/categories/tcl/categories-procs.tcl
Gets the category name in the specified language, if available. Use default language otherwise.
- Parameters:
- category_id (required)
- category_id or list of category_id's for which to get the name.
- locale (optional)
- language in which to get the name. [ad_conn locale] used by default.
- Returns:
- list of names corresponding to the supplied category_id.
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_crud, category_get_procs, category_tree_procs
Source code: if {[nsv_names categories] eq "" || ![nsv_exists categories $category_id]} { return [list] } set cat_lang [lindex [nsv_get categories $category_id] 1] # Try specified locale or the one from the connection if {$locale eq ""} { set locale [ad_conn locale] } if {[dict exists $cat_lang $locale]} { return [dict get $cat_lang $locale] } # Try default locale for this language set language [lindex [split $locale "_"] 0] set locale [lang::util::default_locale_from_lang $language] if {[dict exists $cat_lang $locale]} { return [dict get $cat_lang $locale] } # Try system locale for package (or site-wide) set locale [lang::system::locale] if {[dict exists $cat_lang $locale]} { return [dict get $cat_lang $locale] } # Try site-wide system locale set locale [lang::system::locale -site_wide] if {[dict exists $cat_lang $locale]} { return [dict get $cat_lang $locale] } # Resort to en_US set locale [parameter::get -parameter DefaultLocale -default en_US] if {[dict exists $cat_lang $locale]} { return [dict get $cat_lang $locale] } # tried default locale, but nothing found return [list]XQL Not present: Generic PostgreSQL XQL file: packages/categories/tcl/categories-procs-postgresql.xql
Oracle XQL file: packages/categories/tcl/categories-procs-oracle.xql