Determining the names of the conditional operators by macro

Creating a macro - Writing a Script - Using the API

Determining the names of the conditional operators by macro

Postby joesch » Sun Apr 26, 2020 10:04 am

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
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Postby JeJe » Sun Apr 26, 2020 10:52 am

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.
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1146
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Postby joesch » Sun Apr 26, 2020 11:30 am

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
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Postby Zizi64 » Sun Apr 26, 2020 11:34 am

Please upload an ODF type sample file and your macro code here.
Tibor Kovacs, Hungary; LO6.1.6, 6.2.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.4.5;AOO4.1.7
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.
User avatar
Zizi64
Volunteer
 
Posts: 9542
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Determining the names of the conditional operators by ma

Postby joesch » Sun Apr 26, 2020 11:41 am

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
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Postby JeJe » Sun Apr 26, 2020 11:48 am

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).
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1146
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Postby Zizi64 » Sun Apr 26, 2020 11:54 am

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; LO6.1.6, 6.2.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.4.5;AOO4.1.7
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.
User avatar
Zizi64
Volunteer
 
Posts: 9542
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Determining the names of the conditional operators by ma

Postby joesch » Sun Apr 26, 2020 12:09 pm

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   Expand viewCollapse view
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.
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Postby Lupp » Sun Apr 26, 2020 1:19 pm

(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 7.0 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 2913
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Determining the names of the conditional operators by ma

Postby Lupp » Sun Apr 26, 2020 1:36 pm

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 7.0 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 2913
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Determining the names of the conditional operators by ma

Postby joesch » Sun Apr 26, 2020 2:39 pm

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.
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Postby Lupp » Sun Apr 26, 2020 3:25 pm

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 7.0 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 2913
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Determining the names of the conditional operators by ma

Postby JeJe » Sun Apr 26, 2020 4:23 pm

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.
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1146
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Postby joesch » Sun Apr 26, 2020 5:24 pm

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
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Postby Zizi64 » Sun Apr 26, 2020 5:37 pm

"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; LO6.1.6, 6.2.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.4.5;AOO4.1.7
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.
User avatar
Zizi64
Volunteer
 
Posts: 9542
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Determining the names of the conditional operators by ma

Postby JeJe » Sun Apr 26, 2020 5:39 pm

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.
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1146
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Postby Villeroy » Sun Apr 26, 2020 5:57 pm

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28544
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Determining the names of the conditional operators by ma

Postby joesch » Sun Apr 26, 2020 6:09 pm

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: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Postby joesch » Sun Apr 26, 2020 6:13 pm

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: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Postby joesch » Sun Apr 26, 2020 7:11 pm

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
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Postby Villeroy » Sun Apr 26, 2020 7:24 pm

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28544
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Determining the names of the conditional operators by ma

Postby JeJe » Sun Apr 26, 2020 7:54 pm

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
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1146
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Postby joesch » Sun Apr 26, 2020 8:04 pm

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.
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Postby Villeroy » Sun Apr 26, 2020 8:38 pm

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28544
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Determining the names of the conditional operators by ma

Postby JeJe » Mon Apr 27, 2020 5:31 am

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..)
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1146
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Postby joesch » Mon Apr 27, 2020 6:15 am

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.
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Postby JeJe » Mon Apr 27, 2020 8:33 am

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.
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1146
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determining the names of the conditional operators by ma

Postby joesch » Mon Apr 27, 2020 9:34 am

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.
joesch
 
Posts: 38
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Determining the names of the conditional operators by ma

Postby ms777 » Fri May 01, 2020 2:50 am

the localization can be found in https://svn.apache.org/repos/asf/openoffice/trunk/extras/l10n/source/de/localize.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
ms777
Volunteer
 
Posts: 134
Joined: Mon Oct 08, 2007 1:33 am

Re: Determining the names of the conditional operators by ma

Postby Zizi64 » Fri May 01, 2020 7:02 am

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; LO6.1.6, 6.2.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.4.5;AOO4.1.7
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.
User avatar
Zizi64
Volunteer
 
Posts: 9542
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Next

Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 8 guests