lc_numeric (public)

 lc_numeric num [ fmt ] [ locale ]

Defined in packages/acs-lang/tcl/localization-procs.tcl

Given a number and a locale return a formatted version of the number for that locale.

Parameters:
num - Number in canonical form
fmt (optional) - Format string used by the Tcl format command (should be restricted to the form "%.Nf" if present).
locale (optional) - Locale
Returns:
Localized form of the number

Partial Call Graph (max 5 caller/called nodes):
%3 test_lang_test__lc_content_size_pretty lang_test__lc_content_size_pretty (test acs-lang) lc_numeric lc_numeric test_lang_test__lc_content_size_pretty->lc_numeric test_lang_test__lc_procs lang_test__lc_procs (test acs-lang) test_lang_test__lc_procs->lc_numeric Class ::xowiki::formfield::numeric Class ::xowiki::formfield::numeric (public) Class ::xowiki::formfield::numeric->lc_numeric fs::get_folder_contents fs::get_folder_contents (public) fs::get_folder_contents->lc_numeric lc_content_size_pretty lc_content_size_pretty (public) lc_content_size_pretty->lc_numeric packages/acs-admin/www/auth/authority.tcl packages/acs-admin/ www/auth/authority.tcl packages/acs-admin/www/auth/authority.tcl->lc_numeric packages/acs-developer-support/lib/toolbar.tcl packages/acs-developer-support/ lib/toolbar.tcl packages/acs-developer-support/lib/toolbar.tcl->lc_numeric

Testcases:
lang_test__lc_procs, lang_test__lc_content_size_pretty
Source code:
    if {$fmt ne ""} {
        set out [format $fmt $num]
    } else {
        set out $num
    }

    set sep [lc_get -locale $locale "thousands_sep"]
    set dec [lc_get -locale $locale "decimal_point"]
    set grouping [lc_get -locale $locale "grouping"]

    # Fall back on en_US if grouping is not on valid format
    if { $locale ne "en_US" && ![regexp {^[0-9 -]+$} $grouping] } {
        ns_log Warning "lc_numeric: acs-lang.localization-grouping key has "  "invalid grouping value '$grouping' for locale '$locale'"
        set sep ,
        set dec .
        set grouping 3

    }

    regsub {\.} $out $dec out
    return [lc_sepfmt $out $grouping $sep]
Generic XQL file:
packages/acs-lang/tcl/localization-procs.xql

PostgreSQL XQL file:
packages/acs-lang/tcl/localization-procs-postgresql.xql

Oracle XQL file:
packages/acs-lang/tcl/localization-procs-oracle.xql

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