Bug 125849 - Draw/Writer cannot modify the unit of measure through the ruler above the workspace (Chinese UI only)
Summary: Draw/Writer cannot modify the unit of measure through the ruler above the wor...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
5.4.0.3 release
Hardware: All All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.4.0 target:7.3.1 target:7.2.6
Keywords: bibisected, regression
Depends on:
Blocks:
 
Reported: 2019-06-11 09:16 UTC by yichuang驿窗
Modified: 2022-02-04 14:40 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
screenshot (72.94 KB, image/png)
2019-06-27 07:47 UTC, yichuang驿窗
Details
screenshot6.3.0.0beta2 (65.02 KB, image/png)
2019-06-27 07:49 UTC, yichuang驿窗
Details

Note You need to log in before you can comment on or make changes to this bug.
Description yichuang驿窗 2019-06-11 09:16:00 UTC
Description:
Draw cannot modify the unit of measure through the ruler above the workspace.
If set The language of interface to Chinese(simplified), the measurement unit can not be changed to Centimeter/Meter/Kilometer and so on.
If set The language of interface to English(USA), it's OK.

简体中文界面时,Draw无法通过工作区上方的标尺修改度量单位;
英文界面下这个功能是正常的。 

Steps to Reproduce:
1.Set language of interface to Chinese(simplified) and restart Draw;
2.Right-click on the upper ruler and select meter(米);
3.Check the result, not meter(米);

Actual Results:
millimeter(毫米)

Expected Results:
meter(米)


Reproducible: Always


User Profile Reset: Yes



Additional Info:
System: Debian Stretch 9.9 amd64
Desktop: Gnome/xfce4
Libreoffice: 6.3.0.0 beta1/6.1.5.2/AppImage 6.2.3.2
Comment 1 Xisco Faulí 2019-06-26 08:29:16 UTC
Thanks for reporting this issue.
Could you please paste the info from Help - about LibreOffice ?

I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' once the information has been provided
Comment 2 yichuang驿窗 2019-06-27 07:47:14 UTC
Created attachment 152438 [details]
screenshot

Same as 6.3.0.0 beta2 and 6.1.5.2.
Comment 3 yichuang驿窗 2019-06-27 07:49:18 UTC
Created attachment 152439 [details]
screenshot6.3.0.0beta2

6.3.0.0 beta2
Comment 4 Xisco Faulí 2020-01-20 17:20:12 UTC
I can't reproduce it in

Version: 6.5.0.0.alpha0+
Build ID: fc1f85127968d1c2e0a53dace51bf8a78f9e6ca5
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded

@Franklin, do you reproduce it on your end ?
Comment 5 Xisco Faulí 2020-01-20 17:20:45 UTC
@yichuang,
Could you please try to reproduce it with a master build from http://dev-builds.libreoffice.org/daily/master/ ?
You can install it alongside the standard version.
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the master build
Comment 6 yichuang驿窗 2020-01-29 04:53:55 UTC
I can reproduce it in LibreOfficeDev
版本: 7.0.0.0.alpha0+
Build ID: 4ff12ba6f4639c73587f2bb58afcc3ca6fb30105
CPU 线程: 4; 操作系统: Linux 4.9; UI 渲染: 默认; VCL: gtk3; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2020-01-24_21:09:14
区域语言: en-US (en_US.utf8); UI 语言: zh-CN
Calc: threaded
======above are the Zh-cn(UI) info=======
======below are the En(UI) info==========
Version: 7.0.0.0.alpha0+
Build ID: 4ff12ba6f4639c73587f2bb58afcc3ca6fb30105
CPU threads: 4; OS: Linux 4.9; UI render: default; VCL: gtk3; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2020-01-24_21:09:14
Locale: en-US (en_US.utf8); UI-Language: en-US
Calc: threaded
=============

How to reproduce it:

Modify the UI language from English to Chinese(Simplified) with Tools > Language Settings > Languages > User Interface. And then right click the upper ruler, select 米.

Only point & pica are OK, the rest are all NG.

My OS:
Debian Stretch 9.11/xfce4
Comment 7 Ming Hua 2020-01-29 07:41:09 UTC
I can reproduce with 6.3.4 on Windows 10:
版本: 6.3.4.2 (x64)
Build ID: 60da17e045e08f1793c57c00ba83cdfce946d0aa
CPU 线程: 2; 操作系统: Windows 10.0; UI 渲染: 默认; VCL: win; 
区域语言: zh-CN (zh_CN); UI 语言: zh-CN
Calc: threaded

... and can not reproduce when switched to English UI:
Version: 6.3.4.2 (x64)
Build ID: 60da17e045e08f1793c57c00ba83cdfce946d0aa
CPU threads: 2; OS: Windows 10.0; UI render: default; VCL: win; 
Locale: zh-CN (zh_CN); UI-Language: en-US
Calc: threaded

So comment #0 is right, it only happens on Chinese UI.  Although in my case with Chinese UI, the unit for the ruler is stuck at 厘米 (centimeter).

I'll test some other combinations.
Comment 8 Ming Hua 2020-01-29 08:16:29 UTC
I can reproduce on 6.0.6:
版本:6.0.6.2 (x64)
組建 ID:0c292870b25a325b5ed35f6b45599d2ea4458e77
CPU 執行緒:2; OS:Windows 10.0; UI 算繪:預設; 
語言地區:zh-CN (zh_CN); Calc: group

but not in 5.2.7:
Version: 5.2.7.2 (x64)
Build ID: 2b7f1e640c46ceb28adf43ee075a6e8b8439ed10
CPU Threads: 2; OS Version: Windows 6.19; UI Render: default; 
Locale: zh-CN (zh_CN); Calc: group

So a possible regression.

Strangely, in the case of 6.0.6, both simplified and traditional Chinese UI (zh-CN and zh-TW) are affected, but English and Japanese UI are not.  I wonder what is so special about rulers for Chinese UI.
Comment 9 Franklin Weng 2020-01-29 08:59:18 UTC
Confirmed in version 

版本:6.3.4.2
組建 ID:60da17e045e08f1793c57c00ba83cdfce946d0aa
CPU 執行緒:4; OS:Linux 5.4; UI 算繪:預設; VCL: kde5; 
語言地區:zh-TW (zh_TW.UTF-8); UI語言:zh-TW
Calc: threaded

Version: 6.3.4.2
Build ID: 60da17e045e08f1793c57c00ba83cdfce946d0aa
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: kde5; 
Locale: zh-TW (zh_TW.UTF-8); UI-Language: en-US
Calc: threaded


When UI-language setting to zh-TW, set in the following way:
* set the unit in Tools-Options-LibreOffice Draw to centimeter, OK;
* right-clicking upper rule and set to point, OK;
* then, right-clicking upper rule to mm/cm/m/km/inch/mile/character/line they all are not available and the option would be stay in mm.  
* Other options can work and set to each other, but never the options in the last item.

Setting under Tools-Options works well in both zh-TW and en-US user interface.
Comment 10 Ming Hua 2020-02-01 21:30:35 UTC
Kevin, I think you may be interested in this one.

Also changing component to UI as the ruler in Writer has exactly the same problem.
Comment 11 Kevin Suo 2020-02-02 03:14:21 UTC
(In reply to Ming Hua from comment #10)

This is not bibisectable, because the bibisect repos maintained by the QA currently does not provide language packs. I do maintain my own bibisect repo with zh_CN language pack enabled, but it is only from 2019-07-04.
Comment 12 Kevin Suo 2020-02-02 03:43:07 UTC
When this bug is triggered, I have the following in terminal output:
warn:svtools.control:3445443:3445443:svtools/source/control/ruler.cxx:2416: Ruler::SetUnit() - Wrong Unit

This may happen in all non-English UI. I suspect that's because the function which called Ruler::SetUnit is passing eNewUnit which is non-English char and then falls into non of these "switch" cases.

The only revision to this file, from the git log, seems to be:

author	Mike Kaganski <mike.kaganski@collabora.com>	2018-11-06 14:37:23 +0300
committer Mike Kaganski <mike.kaganski@collabora.com>	2018-11-08 12:15:51 +0100
commit 9e0770ea7e0cf094add54ad64bc9ff825d24bbe1

    Convert FieldUnit to scoped enum

Adding cc @Mike Kaganski: would you please take a look?
Comment 13 Ming Hua 2020-02-02 05:12:14 UTC
(In reply to Kevin Suo from comment #11)
> This is not bibisectable, because the bibisect repos maintained by the QA
> currently does not provide language packs. I do maintain my own bibisect
> repo with zh_CN language pack enabled, but it is only from 2019-07-04.
I see.

(In reply to Kevin Suo from comment #12)
> This may happen in all non-English UI.
As I tested in comment #7, can't reproduce in 6.0.6 with Japanese UI.  Just tested 6.3.5 RC1 with Japanese UI again, confirmed that changing ruler unit using right-clicking works, and the unit names are definitely translated.

バージョン: 6.3.5.1 (x64)
Build ID: 9a62adaf9abe90e8fef419f29114b0176dd66801
CPU threads: 2; OS:Windows 10.0; UI render: default; VCL: win; 
ロケール: zh-CN (zh_CN); UIの言語: ja-JP
Calc: threaded
Comment 14 Kevin Suo 2020-02-02 08:05:21 UTC
With Chinese UI, the "meUnit" as passed to setunit is always "0", thus does not fall into any of these switch cases.
Comment 15 QA Administrators 2022-02-02 03:40:24 UTC Comment hidden (obsolete)
Comment 16 Mike Kaganski 2022-02-02 06:06:40 UTC
Repro using Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: aabc5b0f7c8e9cf6bb711815a67ff6b6e900b5aa
CPU threads: 12; OS: Windows 10.0 Build 19044; UI render: default; VCL: win
Locale: ru-RU (ru_RU); UI: zh-CN
Calc: CL

and Version: 5.4.0.2 (x64)
Build ID:2b906d450a44f2bbe506dcd22c51b3fa11dc65fd
CPU 线程:12; 操作系统:Windows 6.19; UI 渲染:默认; 
Locale: ru-RU (ru_RU); Calc: group

No repro using Version: 5.3.0.3 (x64)
Build ID: 7074905676c47b82bbcfbea1aeefc84afe1c50e1
CPU Threads: 12; OS Version: Windows 6.19; UI Render: default; Layout Engine: new; 
Locale: ru-RU (ru_RU); Calc: group

Bibisected to the range

https://git.libreoffice.org/core/+log/ff8b873936aa72b17309da4bfc2775573a5b1f55%5E..169bd7718264b0e312052757f9bbd2321e1399c2
Comment 17 Mike Kaganski 2022-02-02 06:09:47 UTC
Suspect commit:

https://git.libreoffice.org/core/+/3927105e19d335da6461d853ba5cedda788067da
> author	Caolán McNamara <caolanm@redhat.com>	Tue Apr 11 13:11:08 2017 +0100
> convert ruler menu to .ui
Comment 18 Mike Kaganski 2022-02-02 07:01:41 UTC
Also reproducible using ru-RU.
In Russian UI, as well as in zh-CN, the unit list in the ruler menu includes kilometers and other metric units, which should be filtered out as per SvxRuler::Command (see bReduceMetric).

The problem seems to be in the relation of the ident passed to SvxRuler::MenuSelect from SalInstanceMenu::popup_at_rect (which is not localized, like in 'cm'), and the list created in ImplGetFieldUnits and ImplGetCleanedFieldUnits, which uses localized units (like 'см' or '厘米').

I suppose that ImplGetCleanedFieldUnits could contain both translated and non-translated names maybe? I.e., in ImplGetFieldUnits, add both localized and untranslated entries for each SV_FUNIT_STRINGS element. No idea if that is the correct direction though.
Comment 19 Mike Kaganski 2022-02-02 07:23:54 UTC
Caolan: I don't know if adding two sets (untranslated + translated) into the lists could result in conflicts, where some untranslated name could clash with another unit's translated name, so I don't intend to handle this myself. Please look at it if you have time. Thanks.
Comment 20 Commit Notification 2022-02-03 09:11:26 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2b95b55983689d5476e89c27177351e2d6785047

tdf#125849 cannot modify the ruler unit of measure in translated UI

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Caolán McNamara 2022-02-03 09:12:12 UTC
done in trunk, backport to 7-3 and 7-2 in gerrit
Comment 22 Commit Notification 2022-02-04 14:39:28 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/8ea0cb60e8b16671cb48d17f11605b3684753264

tdf#125849 cannot modify the ruler unit of measure in translated UI

It will be available in 7.3.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 23 Commit Notification 2022-02-04 14:40:46 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/61339f316ec7a91733b62ca667faeca0b75297e9

tdf#125849 cannot modify the ruler unit of measure in translated UI

It will be available in 7.2.6.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.