Determining the names of the conditional operators by macro

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Determining the names of the conditional operators by macro

Post by joesch »

Hello,

How is it possible to determine the local names (i.e. those that are displayed in the GUI) for:
https://www.openoffice.org/api/docs/com ... rator.html

For example, on a German localized OO the term for "BETWEEN" is "zwischen".


Greetings,
joesch
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Post by JeJe »

You could do a search in all you files in your installation folder for the word zwischen to see if you can find a file its in.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Post by joesch »

I don't understand this advice, because e.g. the word "zwischen" appears in many of the files without it being related to a Conditial Operator.

Greetings,
joesch
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Determining the names of the conditional operators by ma

Post by Zizi64 »

Please upload an ODF type sample file and your macro code here.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Post by joesch »

Please upload an ODF type sample file and your macro code here.
I do not have a macro code, because I am looking for a corresponding code. Also there is no file, because I do not want to create or evaluate a file.


Greetings.
joesch
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Post by JeJe »

I don't understand this advice, because e.g. the word "zwischen" appears in many of the files without it being related to a Conditial Operator.
You've got the names of the other operators as well so if you them all together... bingo (maybe).
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Determining the names of the conditional operators by ma

Post by Zizi64 »

I do not have a macro code, because I am looking for a corresponding code.
Haven't you even tried to write the macro?
Also there is no file, because I do not want to create or evaluate a file.
Where you want to launch the macro??? I suppose it: in an .ods file. The file is not exist yet?
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Post by joesch »

Haven't you even tried to write the macro?
That was not necessary, because there is a finished macro from Andrew Pitonyak. But this one only lists the english speaking names, but I want to have the local names:

Code: Select all

Sub Start()
EnumerateEnumerations("com.sun.star.sheet.ConditionOperator")
End Sub

Sub EnumerateEnumerations(sName$)
  Dim oTD       'Die Beschreibung eines Typs.
  Dim s$        'Ausgabestring.
  Dim sNames    'Array der Namen
  Dim lValues   'Array der Werte
  Dim i As Long
  Dim iCount As Integer
  
  oTD = GetOOoConst(sName)
  If IsNull(oTD) Or IsEmpty(oTD) Then
    Exit Sub
  End If
  
  If HasUnoInterfaces(oTD, "com.sun.star.reflection.XEnumTypeDescription") Then
    'MsgBox Join(oTD.getEnumNames(), Chr$(10))
    sNames = oTD.getEnumNames()
    lValues = oTD.getEnumValues()
    For i = LBound(sNames) To UBound(sNames)
      iCount = iCount + 1
      If (iCount > 40) Then
        MsgBox(s)
        s = ""
      End If
      s = s & lValues(i) & Chr$(9) & sNames(i) & Chr$(10)
    Next
  ElseIf HasUnoInterfaces(oTD, _
                          "com.sun.star.reflection.XConstantsTypeDescription") Then
    lValues = oTD.getConstants()
    
    For i = LBound(lValues) To UBound(lValues)
      iCount = iCount + 1
      If (iCount > 40) Then
        MsgBox(s)
        s = ""
      End If
      s = s & lValues(i).getConstantValue() & Chr$(9) & lValues(i).getName() & Chr$(10)
    Next
  Else
    MsgBox "Nicht unterstützter Typ " & sName
    Exit Sub
  End If
  MsgBox s
End Sub

Function GetOOoConst(constString)
  Dim sTDMName$
  Dim oTDM
  
  sTDMName = "/singletons/com.sun.star.reflection.theTypeDescriptionManager"
  oTDM = GetDefaultContext().getValueByName(sTDMName) 
  
  If oTDM.hasByHierarchicalName(constString) Then 
    GetOOoConst = oTDM.getByHierarchicalName(constString) 
  Else 
    MsgBox "Unbekannter Name: " & constString, 16, "OOo-API-Konstante oder Enumeration"
  End If 
End Function
Where you want to launch the macro??? I suppose it: in an .ods file. The file is not exist yet?
The macro will be in an extension and the local termes determined by the macro should be assigned to a list box as .StringItemList.
User avatar
Lupp
Volunteer
Posts: 3542
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Determining the names of the conditional operators by ma

Post by Lupp »

(Just wondering, spoken aside...)
Why should this localization plage be supported?
Why specifically by a forum in English language?
I'm generally working with LibreOffice, and there now are more than 200 locales. I heavily doubt if they all are good quality.
Concerning German (de-DE and 4 additional de- locales) and basically concerning all the languages using a variant of the latin alphabet I would assume that most of the native speakers already know or are capable of learning within two hours the few English terms needed for working in an en- UserInterface and an en- locale.
Why shouldn't they use en- UI and en- locale? Well, there are a few disadavantages, but they could easily be abolished by a minor enhancement to the software. The advantages are many and relevant. One of them the facilitation of global coopertaion.
This forum hasn't a working German branch, and https://ask.libreoffice,org/de (where i also posted until recently - and rarely still do) is very much less active than the English branch https://ask.libreoffice,org/en. Why should I answer in German a question in the German branch if I yesterday took half an hour or more to thoroughly answer a very similar question in English?

Localization beyond the absolutely necessary is a way to hell. (Cf: https://ask.libreoffice.org/en/question ... -my-sheet/)
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
Posts: 3542
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Determining the names of the conditional operators by ma

Post by Lupp »

To exemplify the statements in advance of using English from above:

Interuping for a minute my typing that post, I went to the English askbot for LibreOffice and asked a generalized version of the question under discussion here.

Within 15 minutes I got an interesting answer by Mike Kaganski who is a Russian living and working in Moscow.
See https://ask.libreoffice.org/en/question ... ion-names/.
Well, I know it isn't what you wanted...
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Post by joesch »

First of all: my question is not a question that specifically concerns the German branch of OO.
Why should this localization plage be supported?
Because it is normal that users want to use programs (in this case an extension) in their native language?
Why specifically by a forum in English language?
In which other forum should you ask a question that concerns all languages? And why?
imho can ask any question concerning the program in the subforum whose language is most convenient for the questioner.
This forum hasn't a working German branch
But there is a very good german forum: http://de.openoffice.info

I could also say more on this subject, because there is a reason for this situation. But it probably does not belong in this thread. But feel free to ask for it if you like.
Why should I answer in German a question in the German branch if I yesterday took half an hour or more to thoroughly answer a very similar question in English?
There was NOT a question asked here that concerns the German branch, but a question that concerns all languages was tried to illustrate with a German example.
User avatar
Lupp
Volunteer
Posts: 3542
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Determining the names of the conditional operators by ma

Post by Lupp »

Of course my considerations ("spoken aside") didn't exclusively concern "German" or even this thread.
The exuberant localization campaign simply makes me nervous. We may need to try to get some influence concerning what is normal and what will be normal tomorrow. Living as peoples separated one from another and split in parts additionally by barriers based on hundreds of languages in a world ruled by a widely unified class of the powerful may not come off well.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Post by JeJe »

LibreOffice has an advanced feature missing in OO that allows you to look/search through the registry keys - I couldn't find anything to help you but you might fare better. Apart from searching through the installation files for where the terms are recorded, and the registry, I can't think of anywhere else.

Except possibly google translate - and listing the words in your own language customization. I'd imagine the result would be fairly close for those words.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Post by joesch »

I ask here in an OO forum regarding OpenOffice. So answers about LO are of little use to me when it comes to things that only concern LO.
LibreOffice has an advanced feature missing in OO that allows you to look/search through the registry keys
"registry keys", that means the Windows registry? In this case this is of little use to me, because I need a solution that works independent of the operating system.

btw.: OO can also access the Windows Registry, or is it a special search feature?


Greetings,
joesch
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Determining the names of the conditional operators by ma

Post by Zizi64 »

"registry keys", that means the Windows registry?
not.
The LO has a new feature in the menu item:
Tools - Options - LibreOffice - Advanced - Open Expert Configuration
Expert.png
Expert2.png
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Post by JeJe »

OpenOffice has its own registry which is separate from the Windows registry. Do a search for registry in the threads here.

Unfortunately OO does not allow you to search through this registry like LibreOffice does - but if you looked in LibreOffice and found something there it *might* be the same as in OO as the two have common roots. You'd have to download LibreOffice if you don't have it but you might find a solution that applies to OO as well.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Determining the names of the conditional operators by ma

Post by Villeroy »

I just added a German language pack to my vanilla LO6.4.
The files in directory /opt/libreoffice6.4/program/resource/de/LC_MESSAGES/ look promising.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Post by joesch »

The LO has a new feature in the menu item:
Tools - Options - LibreOffice - Advanced - Open Expert Configuration
This is known to me, only I did not know that it is called Registry.
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Post by joesch »

You'd have to download LibreOffice if you don't have it but you might find a solution that applies to OO as well.
I have been using LO for years, as well as OO, and of course I tried to find a solution myself before asking here in the forum.
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Post by joesch »

The files in directory /opt/libreoffice6.4/program/resource/de/LC_MESSAGES/ look promising.
Thanks. Found 15 *.mo-files in /resource/de/LC_MESSAGES/ that contain my sample word "zwischen". There are about 50 entries of "zwischen" in these 15 files, but there is no entry I can reliably assign to the corresponding dialog.
Furthermore I don't know how to perform this search in a meaningful way, because I currently judge myself if the "zwischen" is located at a position where it is related to the dialog Format-Conditional Formatting.

Greetings,
joesch
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Determining the names of the conditional operators by ma

Post by Villeroy »

Do built-in dialogs have an accessible context?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Post by JeJe »

Don't know how pertinent but, in \OpenOffice 4\program\resource\swen-GB.res (I'm in the UK) all these are listed adjacent to one another

Less Than Or Equal To
Greater Than Or Equal To
Less Than
Greater Than
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Post by joesch »

Do built-in dialogs have an accessible context?
I think not.

Well, in certain dialogs (e.g. file dialog) it is possible to set certain properties, but also no access to all available values of the properties. So you have to know in advance which value a certain property can have to set the right value.
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Determining the names of the conditional operators by ma

Post by Villeroy »

I thought that these interfaces are made for screen readers to serve the visually handicapped. Then you could read all the operator names from the list box of the conditional format dialog.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Post by JeJe »

I thought that these interfaces are made for screen readers to serve the visually handicapped. Then you could read all the operator names from the list box of the conditional format dialog.
The OP would have to show the dialog by macro, then find it, from Stardesktop perhaps, work through the accessiblecontext to the listbox etc.

Alternatively a most-likely-used or at least understandable pre-prepared translation for those few words could be got through google translate in seconds. The effort of the above 23 replies might exceed doing that for a hundred languages...

(I'm bailing..)
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Post by joesch »

Alternatively a most-likely-used or at least understandable pre-prepared translation for those few words could be got through google translate in seconds. The effort of the above 23 replies might exceed doing that for a hundred languages...
This is unfortunately not an alternative, because it would mean that my macro can only work if there is an online connection.

By the way, I would like to use the exact translation used in the local versions of OO. Google Translate only provides an approximate translation, e.g. for "greater equal" "größer gleich", but I need "größer oder gleich".

So I am afraid that there is no (satisfactory) solution to my question.

Thank you, everyone who tried to help.
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Post by JeJe »

My suggestion was to use google translate to create the list that can be loaded from depending on the user's language. That's how language customisation is generally done. You have an exact translation for German as you know it so you wouldn't use it for that, only for the ones you don't know.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Post by joesch »

My suggestion was to use google translate to create the list that can be loaded from depending on the user's language.
yes, clear
That's how language customisation is generally done.
Well ... OO itself uses fixed translated terms for each local version and does not use Google translate. My hope was to be able to read out these terms that exist in the localized versions. This would have saved me the effort to put the local terms needed by my extension into the extension again.
ms777
Volunteer
Posts: 177
Joined: Mon Oct 08, 2007 1:33 am

Re: Determining the names of the conditional operators by ma

Post by ms777 »

the localization can be found in https://svn.apache.org/repos/asf/openof ... calize.sdf, WIN_CONDITION.LB_OP 1 to 8. If you want to go that way you can download and parse that by macro ...

Good luck,

ms777
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Determining the names of the conditional operators by ma

Post by Zizi64 »

As I see your sample code, it will be a StarBasic related extension.

In my opinion you must use pretranslated (localized) string constants in your program code for every supported languages (what YOU want support).

If the code of the extension must search the translated strings in every case (when a localized string must be appeared in your extension) in a multilanguage "database" or many "registry-like lists", then the extension will run very slowly.

I just checked some existing sample extensions (written in StarBasic) on the Extensions site, and I have experienced it: the localized strings for the supported languages are present in the program code itself or they are in some textual lists in separated files inside the extension.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply