Bug 462128 - Some percentage values are not locale-formatted
Summary: Some percentage values are not locale-formatted
Status: CONFIRMED
Alias: None
Product: krita
Classification: Applications
Component: Translation (show other bugs)
Version: 5.1.3
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-22 14:06 UTC by Emir SARI
Modified: 2025-02-12 07:03 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
screenshot of translatable strings (77.12 KB, image/png)
2022-12-08 16:37 UTC, Emir SARI
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emir SARI 2022-11-22 14:06:52 UTC
Example:

On the initial main screen, there are two instances of "Opacity: 100%" (or some other opacity value).

These percentage values look like they are hard-coded to %1%. But however, there are some languages that prepend the percentage sign to the number or use spaces and else. In order to able to fix it, these values should be open for translation.
Comment 1 Halla Rempt 2022-12-08 14:27:48 UTC
Hm, the code is following the recommended way of setting labels, value and suffix on the sliders:

slOpacity->setPrefix(QString("%1 ").arg(i18n("Opacity:")));
slOpacity->setSuffix(i18n("%"));
slider->setValue(100);

Are there any sliders in Krita where you think this is done correctly?
Comment 2 Emir SARI 2022-12-08 16:37:03 UTC
Created attachment 154435 [details]
screenshot of translatable strings

Sure, please see the screenshot. These are the strings that are allowed to be translated.

I am not fully versed on how KF sliders work, but I think replacing the QString with an i18n wrapper (and omitting the second line) would expose the string for translation.
Comment 3 Bug Janitor Service 2022-12-09 05:13:04 UTC
Thanks for your comment!

Automatically switching the status of this bug to REPORTED so that the KDE team
knows that the bug is ready to get confirmed.

In the future you may also do this yourself when providing needed information.
Comment 4 Alvin Wong 2022-12-09 09:12:41 UTC
This is related to a patch I have: https://invent.kde.org/graphics/krita/-/merge_requests/1159

I'm not sure if I will get back to it soon.
Comment 5 Halla Rempt 2022-12-09 10:07:37 UTC
Okay, setting to confirmed then.
Comment 6 Emir SARI 2023-12-25 10:02:05 UTC
So, thanks to Alvin and Dmitry's work, and some contribution from my side, most of these are tackled. The remaining ones are here:

plugins/tools/tool_transform2/wdg_tool_transform.ui:971
plugins/tools/tool_transform2/wdg_tool_transform.ui:987
libs/ui/forms/wdgdisplaysettings.ui:434
libs/ui/layerstyles/wdgInnerGlow.ui:220
libs/ui/layerstyles/wdgInnerGlow.ui:322
libs/ui/layerstyles/wdgInnerGlow.ui:351
plugins/generators/pattern/wdgpatternoptions.ui:90
plugins/generators/pattern/wdgpatternoptions.ui:116
plugins/impex/jxl/kis_wdg_options_jpegxl.ui:638
plugins/impex/jxl/kis_wdg_options_jpegxl.ui:690
plugins/impex/jxl/kis_wdg_options_jpegxl.ui:837
plugins/impex/tiff/kis_wdg_options_tiff.ui:277
plugins/impex/webp/kis_wdg_options_webp.ui:82
plugins/impex/webp/kis_wdg_options_webp.ui:305
plugins/impex/webp/kis_wdg_options_webp.ui:328
plugins/impex/webp/kis_wdg_options_webp.ui:466
plugins/impex/webp/kis_wdg_options_webp.ui:596
plugins/impex/webp/kis_wdg_options_webp.ui:684
plugins/impex/webp/kis_wdg_options_webp.ui:750
plugins/impex/webp/kis_wdg_options_webp.ui:773
plugins/paintops/curvebrush/kis_curve_paintop_settings.cpp:137
plugins/paintops/experiment/kis_experiment_paintop_settings.cpp:78
plugins/paintops/experiment/kis_experiment_paintop_settings.cpp:147
plugins/paintops/libpaintop/KisCurveOptionWidget.cpp:61
plugins/paintops/libpaintop/KisCurveOptionWidget.cpp:78
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:20
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:22
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:23
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:24
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:25
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:26
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:27
plugins/paintops/mypaint/MyPaintSensorPack.cpp:48
plugins/paintops/mypaint/MyPaintSensorPack.cpp:49
plugins/paintops/mypaint/MyPaintSensorPack.cpp:50
plugins/paintops/spray/KisSprayShapeOptionModel.cpp:88

I want to have a look at these before Krita 5.3, but if someone is bored and wants to have a look, please go ahead. :)
Comment 7 ross.erosales 2025-02-12 05:05:18 UTC
Updated list of remaining changes need to be made:

libs/ui/layerstyles/wdgInnerGlow.ui:220
libs/ui/layerstyles/wdgInnerGlow.ui:322
libs/ui/layerstyles/wdgInnerGlow.ui:351
plugins/generators/pattern/wdgpatternoptions.ui:90
plugins/generators/pattern/wdgpatternoptions.ui:116
plugins/impex/tiff/kis_wdg_options_tiff.ui:277
plugins/paintops/curvebrush/kis_curve_paintop_settings.cpp:137
plugins/paintops/experiment/kis_experiment_paintop_settings.cpp:78
plugins/paintops/experiment/kis_experiment_paintop_settings.cpp:147
plugins/paintops/libpaintop/KisCurveOptionWidget.cpp:61
plugins/paintops/libpaintop/KisCurveOptionWidget.cpp:78
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:20
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:22
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:23
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:24
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:25
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:26
plugins/paintops/libpaintop/KisDynamicSensorFactoryRegistry.cpp:27
plugins/paintops/mypaint/MyPaintSensorPack.cpp:48
plugins/paintops/mypaint/MyPaintSensorPack.cpp:49
plugins/paintops/mypaint/MyPaintSensorPack.cpp:50
plugins/paintops/spray/KisSprayShapeOptionModel.cpp:88
Comment 8 Lukas Sommer 2025-02-12 07:03:11 UTC
There is now also support for this out of the box for QSpinBox in ki18n.

API: setupSpinBoxFormatString(): https://api.kde.org/frameworks/ki18n/html/namespaceKLocalization.html 
Blog entry: https://www.volkerkrause.eu/2024/08/16/kf6-localized-spin-box-prefix-suffix.html