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):
%3 test_category_crud category_crud (test categories) category_tree::get_translation category_tree::get_translation test_category_crud->category_tree::get_translation test_category_tree_import category_tree_import (test categories) test_category_tree_import->category_tree::get_translation ad_conn ad_conn (public) category_tree::get_translation->ad_conn parameter::get parameter::get (public) category_tree::get_translation->parameter::get category_tree::get_data category_tree::get_data (public) category_tree::get_data->category_tree::get_translation category_tree::get_name category_tree::get_name (public) category_tree::get_name->category_tree::get_translation packages/categories/lib/tree-form.tcl packages/categories/ lib/tree-form.tcl packages/categories/lib/tree-form.tcl->category_tree::get_translation

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 $names
XQL 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

[ hide source ] | [ make this the default ]
Show another procedure: