Forum .LRN Q&A: I can't get applets chunk sorted (i18n)

On one-community-admin page, I have added a list of installed or active applets. Anyway, the same code as in applets-chunk.tcl

I have added template::multirow sort active_applets -ascii -increasing applet_pretty_name
after the append foreach, but I can't get that list sorted in spanish.

Am I doing anything wrong?

Collapse
Posted by Derick Leony on
You are sorting it before the message keys are actually replaced. So, it's sorting it based on the message keys.

The fastest (not sure if best) way to do it that I can think of is converting it to a list of lists and then use lang::util::localize_list_of_lists

Collapse
Posted by Michael Cordova on
So, it's sorting it based on the message keys.
I've also tried to append the translation, doing that:
set applet_pretty_name [dotlrn_community::applet_call $applet_key GetPrettyName]
template::multirow append active_applets $applet_key $applet_pretty_name "[_ $applet_pretty_name]"

but I got the same order, based on english name (i.ex. assesment_applet is always the first one, although in spanish should be third or fourth)

[...]

Ok, after reading twice your message and my code, I understood what was wrong.

[...] converting it to a list of lists and then use lang::util::localize_list_of_lists

What I've done is...

set aa_list [template::util::multirow_to_list active_applets]
set aa_list_localized [lang::util::localize_list_of_lists -list $aa_list]
template::util::list_to_multirow active_applets $aa_list_localized

And it works! Thanks.