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 (required)
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 test_lc__commify_number lc__commify_number (test acs-tcl) test_lc__commify_number->lc_numeric lc_get lc_get (public) lc_numeric->lc_get lc_sepfmt lc_sepfmt (private) lc_numeric->lc_sepfmt Class ::xowiki::formfield::numeric Class ::xowiki::formfield::numeric (public) Class ::xowiki::formfield::numeric->lc_numeric fs::get_folder_contents fs::get_folder_contents (public, deprecated) 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-admin/www/users/index.tcl packages/acs-admin/ www/users/index.tcl packages/acs-admin/www/users/index.tcl->lc_numeric

Testcases:
lang_test__lc_procs, lang_test__lc_content_size_pretty, lc__commify_number
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]
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-lang/tcl/localization-procs.xql

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