Index: openacs-4/packages/acs-lang/tcl/lang-util-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/lang-util-procs.tcl,v diff -u -N -r1.38 -r1.39 --- openacs-4/packages/acs-lang/tcl/lang-util-procs.tcl 5 Jun 2005 19:41:58 -0000 1.38 +++ openacs-4/packages/acs-lang/tcl/lang-util-procs.tcl 7 Jun 2005 06:49:49 -0000 1.39 @@ -752,4 +752,36 @@ set foreign_var "\[$foreign_var\]" } } -} \ No newline at end of file +} + +ad_proc -public lang::util::convert_to_i18n { + {-locale} + {-package_key "acs-translations"} + {-message_key ""} + {-prefix ""} + {-text:required} +} { + Internationalising of Attributes. This is done by storing the attribute with it's acs-lang key +} { + + if {[empty_string_p $message_key]} { + if {[empty_string_p $prefix]} { + # Having no prefix or message_key is discouraged as it + # might have interesting side effects due to double + # meanings of the same english string in multiple contexts + # but for the time being we should still allow this. + set message_key [lang::util::suggest_key $text] + } else { + set message_key "${prefix}_[lang::util::suggest_key $text]" + } + } + + # Register the language keys + lang::message::register en_US $package_key $message_key $text + if {[exists_and_not_null locale]} { + lang::message::register $locale $package_key $message_key $text + } + + return "#${package_key}.${message_key}#" +} +