Ask Your Question
0

Empty values in a localized dialog

asked 2018-08-01 22:03:42 +0200

Jim K gravatar image

updated 2018-08-01 22:05:16 +0200

As an example, try the following.

  1. Tools -> Macros -> Organize Dialogs. This should expand to My Dialogs -> Standard by default.
  2. Press New... to create Dialog1, then Edit.
  3. Create a new text box, called TextField1 by default.
  4. Dialog -> Manage Language. Pressing Add gave English (USA) on my system, but I'm guessing this will work for whatever locale you choose.
  5. Press Close. Notice that the Text... value for TextField1 is empty.

Now run the following Basic code (my actual code is in Python).

Sub GetDefaultEmptyText
    DialogLibraries.LoadLibrary("Standard")
    oDlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
    oCtrl = oDlg.getControl("TextField1")
    MsgBox "<<" & oCtrl.getText() & ">>"
End Sub

The result is something like <<&14.Dialog1.TextField1.Text>>. What I want instead is <<>>, which is what happens if the dialog is not localized.

The help text shows a similar problem, with &amp;13.Dialog1.TextField1.HelpText appearing in a tooltip, instead of nothing.

So, how to create fields with empty values in a localized dialog?

Solutions that require editing the .xdl file with a text editor are acceptable. The file LibreOffice/4/user/basic/Standard/Dialog1.xdl shows this line.

<dlg:textfield dlg:id="TextField1" dlg:tab-index="0" dlg:left="29" dlg:top="37" dlg:width="100" dlg:height="19" dlg:help-text="&amp;13.Dialog1.TextField1.HelpText" dlg:value="&amp;14.Dialog1.TextField1.Text"/>

And in DialogStrings_en_US.properties:

13.Dialog1.TextField1.HelpText=
14.Dialog1.TextField1.Text=
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2018-08-01 22:14:30 +0200

Jim K gravatar image

The following edit to the .xdl file seems to fix the problem.

dlg:help-text="" dlg:value=""

However, I vaguely remember doing this a while back and having some kind of problem.

For one thing, if the text should be empty in one language but has a value in another one, then this solution does not work.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-08-01 22:03:42 +0200

Seen: 39 times

Last updated: Aug 01 '18