Ask Your Question
0

UI, locale: translation table for keywords and function names

asked 2020-04-26 12:50:17 +0200

Lupp gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-04-26 13:04:46 +0200

Try this (taken from https://forumooo.ru/index.php/topic,8055.45/msg,54405.html (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
edit flag offensive delete link more

Comments

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: https://ask.libreoffice.org/en/questi....
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?

Lupp gravatar imageLupp ( 2020-04-26 13:42:58 +0200 )edit

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.

erAck gravatar imageerAck ( 2020-04-27 00:36:16 +0200 )edit

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...
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.)

Lupp gravatar imageLupp ( 2020-04-27 14:22:43 +0200 )edit

Geez.. thanks for reminding me why I hate "forums".

erAck gravatar imageerAck ( 2020-04-28 02:07:02 +0200 )edit

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.

Lupp gravatar imageLupp ( 2020-04-28 10:34:07 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-04-26 12:50:17 +0200

Seen: 39 times

Last updated: Apr 26