tdf#172952 uitabpage: Use separate strings for the Apply to X button

The dialog for choosing a UI has a button at the bottom to apply the
setting only to the current module and it has the text “Apply to
%MODULE” where %MODULE gets replaced with a non-translatable name for
the module.

For better or worse, some translations (such as Esperanto) have
different names for the modules. For example Writer is Verkilo. For the
sake of consistency, it would be nice to be able to translate these
strings.

It is also difficult translate this string in languages that have a lot
of grammatical cases. For example, in Slovakian the translator might
ideally want to translate the string as “Použiť vo Writeri” and “Použiť
v Calcu” etc, but they currently can’t do this because they would need
to be able to add a different suffix depending on which module is being
used.

In order to fix both problems there is now a specific string with the
whole text for each module.

Change-Id: I7c478790d89bf33f26b53642a076f9e308d1e64a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208800
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
This commit is contained in:
Neil Roberts
2026-07-31 12:39:05 +02:00
parent 33cdc558f9
commit dce6dcd302
2 changed files with 34 additions and 3 deletions
+6 -1
View File
@@ -387,7 +387,12 @@
#define RID_CUISTR_ADDITIONS_THEMES NC_("RID_SVXSTR_ADDITIONS_THEMES", "Extensions: Color Themes")
#define RID_CUISTR_ADDITIONS_TEMPLATES NC_("RID_SVXSTR_ADDITIONS_TEMPLATES", "Extensions: Templates")
#define RID_CUISTR_UI_APPLY NC_("RID_SVXSTR_UI_APPLY", "Apply to %MODULE")
// Application names for the “Apply to X” button in the UI chooser dialog
#define RID_CUISTR_UI_APPLY_TO_WRITER NC_("RID_CUISTR_UI_APPLY_TO_WRITER", "Apply to Writer")
#define RID_CUISTR_UI_APPLY_TO_CALC NC_("RID_CUISTR_UI_APPLY_TO_CALC", "Apply to Calc")
#define RID_CUISTR_UI_APPLY_TO_IMPRESS NC_("RID_CUISTR_UI_APPLY_TO_IMPRESS", "Apply to Impress")
#define RID_CUISTR_UI_APPLY_TO_DRAW NC_("RID_CUISTR_UI_APPLY_TO_DRAW", "Apply to Draw")
#define RID_CUISTR_UI_APPLYALL NC_("RID_SVXSTR_UI_APPLYALL", "Apply to All")
#define RID_CUISTR_OLE_INSERT NC_("RID_SVXSTR_OLE_INSERT", "Inserting OLE object...")
+28 -2
View File
@@ -22,6 +22,33 @@
#include <vcl/tabs.hrc>
#include <vcl/weld/Builder.hxx>
namespace
{
OUString lcl_GetApplyToText()
{
if (std::optional<vcl::EnumContext::Application> sApp = UITabPage::GetCurrentAppEnum())
{
switch (*sApp)
{
case vcl::EnumContext::Application::Writer:
return CuiResId(RID_CUISTR_UI_APPLY_TO_WRITER);
case vcl::EnumContext::Application::Calc:
return CuiResId(RID_CUISTR_UI_APPLY_TO_CALC);
case vcl::EnumContext::Application::Impress:
return CuiResId(RID_CUISTR_UI_APPLY_TO_IMPRESS);
case vcl::EnumContext::Application::Draw:
return CuiResId(RID_CUISTR_UI_APPLY_TO_DRAW);
default:
break;
}
}
assert(!"UI picker dialog used for unsupported application");
return OUString();
}
}
UIPickerDialog::UIPickerDialog(weld::Window* pParent)
: SfxTabDialogController(pParent, u"cui/ui/uipickerdialog.ui"_ustr, u"UIPickerDialog"_ustr)
, m_xOKBtn(m_xBuilder->weld_button(u"ok"_ustr))
@@ -39,8 +66,7 @@ UIPickerDialog::UIPickerDialog(weld::Window* pParent)
// it's mandatory for gtk3 to set the icon before changing the label
m_xApplyBtn->set_from_icon_name("sw/res/sc20558.png");
m_xApplyBtn->set_label(
CuiResId(RID_CUISTR_UI_APPLY).replaceFirst("%MODULE", UITabPage::GetCurrentApp()));
m_xApplyBtn->set_label(lcl_GetApplyToText());
m_xResetBtn->set_label(CuiResId(RID_CUISTR_UI_APPLYALL));
m_xApplyBtn->connect_clicked(LINK(this, UIPickerDialog, OnApplyClick));
m_xResetBtn->connect_clicked(LINK(this, UIPickerDialog, OnApplyClick));