Many standard elements occurring in the component window, in dialogs, in the formula bars, and …(?) use keywords, function names (or …) depending on the chosen UI language and the locale.
There must be respective translation tables.
How can I find them? How are they accessible via the API?
Try this (taken from Calc: ArrayFormulaLocal ? : Открытые офисные пакеты. Форум поддержки пользователей (Rus)):
Sub ShowFormulaOpCodes
Dim oFormula, DataArray, v1, v2, i as Long, arr2
oFormula=CreateUnoService("com.sun.star.sheet.FormulaOpCodeMapper")
v1=oFormula.getAvailableMappings(6, &H07fffffff) ' FormulaLanguage: 6=API
v2=oFormula.getAvailableMappings(3, &H07fffffff) ' FormulaLanguage: 3=NATIVE
Redim DataArray(Ubound(v1)+1)
DataArray(0)=Array("Name", "LocalName", "OpCode") ' Headers
For i=0 To Ubound(v1)
redim arr2(2)
arr2(0)=v1(i).Name
arr2(1)=v2(i).Name
arr2(2)=v1(i).Token.OpCode
DataArray(i+1)=arr2
Next i
ShowDataArray DataArray
End Sub
' Show DataArray in new Calc document
Sub ShowDataArray(DataArray)
Dim oDoc, oSheet, oRange
oDoc = StarDesktop.loadComponentFromURL( "private:factory/scalc", "_blank", 0, Array() )
oSheet = oDoc.getSheets().getByIndex(0)
oRange=oSheet.getCellRangeByPosition(0,0,Ubound(DataArray(0)),Ubound(DataArray),0)
oRange.SetDataArray DataArray
End Sub
Thanks a lot for the quick reply. It’s really interesting. I didn’t know about that interface.
However, my interest was stimulated by a request in a different forum: UI, locale: translation table for keywords and function names.
As I see the tools offered by the used inteface only address the mapping of names to OpCodes and vive.
Are there similar tools for different fileds of needing translations?
I’m not sure, are you talking of UI translation? There’s no external API to obtain translated UI strings for an English string, but maybe I just misunderstood.
Also (and mainly) the other way: From UI/locale language to standard/default language.
It was generally about the translation of terms depending on the language/country/variant (the locale in short) used due to the UI setting or to the locale setting or to specific settings for a docuemnt or for child objects.
As often I didn’t address a specific need I had personally, but was interested in better understanding. The lack in understanding was unveiled in this case by a request in a forum:
https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=101773
Generally I had expected one or more API services giving access to the translated/standardized version of any of such terms to the “development language” (en-US ?) and to the persistent representation used when writing to the file.
(In fact I still don’t understand the concepts locales and their usage are based on.)
Geez… thanks for reminding me why I hate “forums”.
I’m not really good in hating, but if I once should try again, this askbot site is one of the prime candidates for being the object. Meanwhile I admire it for its surpassing misconfiguration. It’s not easy to find this level of perfection.