As an example, try the following.
-
Tools → Macros → Organize Dialogs. This should expand to
My Dialogs -> Standard
by default. - Press New… to create
Dialog1
, then Edit. - Create a new text box, called
TextField1
by default. -
Dialog → Manage Language. Pressing Add gave
English (USA)
on my system, but I’m guessing this will work for whatever locale you choose. - 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 &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="&13.Dialog1.TextField1.HelpText" dlg:value="&14.Dialog1.TextField1.Text"/>
And in DialogStrings_en_US.properties
:
13.Dialog1.TextField1.HelpText=
14.Dialog1.TextField1.Text=