Resolves tdf#105000 - Make shipped palette names translatable

Change-Id: Ifd062cf25c6e930da56571e01c21bd9d2ddf6ddd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170394
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Tested-by: Jenkins
This commit is contained in:
Heiko Tietze 2024-07-12 09:03:38 +02:00 committed by Heiko Tietze
parent 913e26de02
commit 5e45351c52
3 changed files with 36 additions and 9 deletions

View file

@ -559,6 +559,14 @@
#define RID_SVXSTR_GRAFMODE_MONO NC_("RID_SVXSTR_GRAFMODE_MONO", "Black/White")
#define RID_SVXSTR_GRAFMODE_WATERMARK NC_("RID_SVXSTR_GRAFMODE_WATERMARK", "Watermark")
#define RID_SVXSTR_COLORBAR NC_("RID_SVXSTR_COLORBAR", "Left click to apply as background color, right click to set line color")
// SOC color palettes
#define RID_SVXSTR_COLOR_PALETTE_STANDARD NC_("RID_SVXSTR_COLOR_PALETTE_STANDARD", "Standard")
#define RID_SVXSTR_COLOR_PALETTE_TONAL NC_("RID_SVXSTR_COLOR_PALETTE_TONAL", "Tonal")
#define RID_SVXSTR_COLOR_PALETTE_HTML NC_("RID_SVXSTR_COLOR_PALETTE_HTML", "HTML")
#define RID_SVXSTR_COLOR_PALETTE_CHARTPALETTES NC_("RID_SVXSTR_COLOR_PALETTE_CHARTPALETTES", "Chart Palettes")
#define RID_SVXSTR_COLOR_PALETTE_COMPATIBILITY NC_("RID_SVXSTR_COLOR_PALETTE_COMPATIBILITY", "Compatibility")
#define RID_SVXSTR_COLOR_PALETTE_MATERIAL NC_("RID_SVXSTR_COLOR_PALETTE_MATERIAL", "Material")
#define RID_SVXSTR_COLOR_PALETTE_FREECOLOURHLC NC_("RID_SVXSTR_COLOR_PALETTE_FREECOLOURHLC", "Freecolour HLC")
// Default colors
#define RID_SVXSTR_COLOR_DEFAULT_FONT NC_("RID_SVXSTR_COLOR_DEFAULT_FONTCOLOR", "Dark Red 2")
#define RID_SVXSTR_COLOR_DEFAULT_FRAMELINE NC_("RID_SVXSTR_COLOR_DEFAULT_FRAMELINE", "Blue")
@ -1116,7 +1124,7 @@
// This is duplicated in GenericCommands.xcu in officecfg.
#define RID_SVXSTR_CHARFONTNAME NC_("RID_SVXSTR_CHARFONTNAME", "Font Name")
#define RID_SVXSTR_CHARFONTNAME_NOTAVAILABLE NC_("RID_SVXSTR_CHARFONTNAME_NOTAVAILABLE", "Font Name. The current font is not available and will be substituted.")
#define RID_SVXSTR_CUSTOM_PAL NC_("RID_SVXSTR_CUSTOM_PAL", "custom")
#define RID_SVXSTR_CUSTOM_PAL NC_("RID_SVXSTR_CUSTOM_PAL", "Custom")
#define RID_SVXSTR_DOC_COLORS NC_("RID_SVXSTR_DOC_COLORS", "Document colors")
#define RID_SVXSTR_THEME_COLORS NC_("RID_SVXSTR_THEME_COLORS", "Theme colors")
#define RID_SVXSTR_DOC_COLOR_PREFIX NC_("RID_SVXSTR_DOC_COLOR_PREFIX", "Document Color")

View file

@ -36,7 +36,7 @@ class CalcCellBackgroundColorSelector(UITestCase):
color_selector = xColorpage.getChild("colorset")
# For chart-palettes colors
select_by_text(xpaletteselector, "chart-palettes")
select_by_text(xpaletteselector, "Chart Palettes")
# Select Color with id 2
color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "2"}))
self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "2")
@ -54,7 +54,7 @@ class CalcCellBackgroundColorSelector(UITestCase):
self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(126,0,33)")
# For libreoffice colors
select_by_text(xpaletteselector, "libreoffice")
select_by_text(xpaletteselector, "LibreOffice")
# Select Color with id 6
color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "6"}))
self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "6")
@ -72,7 +72,7 @@ class CalcCellBackgroundColorSelector(UITestCase):
self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(255,215,76)")
# For html colors
select_by_text(xpaletteselector, "html")
select_by_text(xpaletteselector, "HTML")
# Select Color with id 1
color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"}))
self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "1")
@ -87,7 +87,7 @@ class CalcCellBackgroundColorSelector(UITestCase):
self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Navy")
# For freecolour-hlc colors
select_by_text(xpaletteselector, "freecolour-hlc")
select_by_text(xpaletteselector, "Freecolour HLC")
# Select Color with id 988
color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "988"}))
self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "988")
@ -102,7 +102,7 @@ class CalcCellBackgroundColorSelector(UITestCase):
self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "HLC 190 50 20")
# For tonal colors
select_by_text(xpaletteselector, "tonal")
select_by_text(xpaletteselector, "Tonal")
# Select Color with id 17
color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "17"}))
self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "17")
@ -117,7 +117,7 @@ class CalcCellBackgroundColorSelector(UITestCase):
self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Magenta 82%")
# For material colors
select_by_text(xpaletteselector, "material")
select_by_text(xpaletteselector, "Material")
# Select Color with id 9
color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "9"}))
self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "9")
@ -127,7 +127,7 @@ class CalcCellBackgroundColorSelector(UITestCase):
self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Gray 800")
# For standard colors
select_by_text(xpaletteselector, "standard")
select_by_text(xpaletteselector, "Standard")
# Select Color with id 3
color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "3"}))
self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "3")
@ -161,7 +161,7 @@ class CalcCellBackgroundColorSelector(UITestCase):
color_selector = xColorpage.getChild("colorset")
# For chart-palettes colors
select_by_text(xpaletteselector, "chart-palettes")
select_by_text(xpaletteselector, "Chart Palettes")
# Select Color with id 2
color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "2"}))
self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "2")

View file

@ -137,12 +137,31 @@ void PaletteManager::LoadPalettes()
if( aFName.endsWithIgnoreAsciiCase(".gpl") )
pPalette.reset(new PaletteGPL(aFileStat.getFileURL(), aFNameWithoutExt));
else if( aFName.endsWithIgnoreAsciiCase(".soc") )
{
if (aFNameWithoutExt == "standard")
aFNameWithoutExt = SvxResId(RID_SVXSTR_COLOR_PALETTE_STANDARD);
else if (aFNameWithoutExt == "tonal")
aFNameWithoutExt = SvxResId(RID_SVXSTR_COLOR_PALETTE_TONAL);
else if (aFNameWithoutExt == "html")
aFNameWithoutExt = SvxResId(RID_SVXSTR_COLOR_PALETTE_HTML);
else if (aFNameWithoutExt == "chart-palettes")
aFNameWithoutExt = SvxResId(RID_SVXSTR_COLOR_PALETTE_CHARTPALETTES);
else if (aFNameWithoutExt == "compatibility")
aFNameWithoutExt = SvxResId(RID_SVXSTR_COLOR_PALETTE_COMPATIBILITY);
else if (aFNameWithoutExt == "material")
aFNameWithoutExt = SvxResId(RID_SVXSTR_COLOR_PALETTE_MATERIAL);
else if (aFNameWithoutExt == "libreoffice")
aFNameWithoutExt = "LibreOffice";
else if (aFNameWithoutExt == "freecolour-hlc")
aFNameWithoutExt = SvxResId(RID_SVXSTR_COLOR_PALETTE_FREECOLOURHLC);
pPalette.reset(new PaletteSOC(aFileStat.getFileURL(), aFNameWithoutExt));
}
else if ( aFName.endsWithIgnoreAsciiCase(".ase") )
pPalette.reset(new PaletteASE(aFileStat.getFileURL(), aFNameWithoutExt));
if( pPalette && pPalette->IsValid() )
m_Palettes.push_back( std::move(pPalette) );
aNames.insert(aFNameWithoutExt);
}
}