datadoit
|
| Posted: 07/26/2010, 8:13 AM |
|
This is a little backwards, but wondering if it's possible...
Translated text can be set via:
$CCSLocales->GetText("CCS_Cancel");
which will pull the translated value of "Cancel" depending on the
current locale, or CCGetSession("locale",""). You can even pull a
specific translation's value via:
$CCSLocales->GetText("CCS_Cancel", "", "es");
which will only pull the Spanish translation of "Cancel", regardless of
what the current locale is.
What I would like to do now is to test the -name- of the specific
translation. ie: If I have a value of "Cancelar", I would like to know
the name of the translation that it belongs to. In this case, the name
of the translation would be "CCS_Cancel".
Now I know I can load in the appropriate translation file and build an
associative array from it, then look for the word and get it's
associated value. Just wondering if there's something in CCS that does
this already.
|
|
|
 |
mrachow
Posts: 509
|
| Posted: 08/01/2010, 5:01 AM |
|
I suppose there were no idea what it could be useful for.
I guess you can easily access the "real" label and would like to show it in a different language elsewhere?
Or would you like to use the translated strings as a kind of dictionary?
Being curious only.
_________________
Best regards,
Michael |
 |
 |
datadoit
|
| Posted: 08/01/2010, 7:17 AM |
|
In the particular situation that I ran into, the menu and file system
that is being used is a fully translated system. That means when
looking at the URL it too is translated.
?locale=en&module=Administration
or
?lugar=es&módulo=Administración
So what happens if those URL parameters are manually changed? I need a
way to deal with that. The simplest and I think ideal way to deal with
that would be to be able to use the Locales class to check the actual
value if given by adding an extra variable, something like:
$ccsresult = $CCSLocales->GetText("","","", "Administración");
Then $ccsresult would return the -name- of the translation, such as
'CCS_Administration'. That could then be validated against what the
actual locale is for the current session, and display the appropriate
translation.
Currently I'm ripping through all of the translation files for the value
by loading the translation file into an associative array, and pulling
it's translation name if found. It's the exact same thing that CCS does
with the LoadTranslation() function. I could avoid this by Yes making a
small expansion on the Locales class to add this extra variable. I'd
rather have them do all the work. :)
|
|
|
 |
mrachow
Posts: 509
|
| Posted: 08/01/2010, 9:23 AM |
|
I see.
Even if this extension would be build I expect one target language will match Administration page when searching for Administration. Or one of the target languages will do searching case sensitive the others not. So it would most likely last a while until this function will serve the requirements (Not wanting to blame Yes in paticurlar, but seeing this as common steps to final version).
So I suppose it's better to have your own function available
_________________
Best regards,
Michael |
 |
 |
|