Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio delay units uses two lines in Hebrew #4895

Open
1 task done
low-batt opened this issue Apr 26, 2024 · 11 comments · May be fixed by #4896
Open
1 task done

Audio delay units uses two lines in Hebrew #4895

low-batt opened this issue Apr 26, 2024 · 11 comments · May be fixed by #4896

Comments

@low-batt
Copy link
Contributor

low-batt commented Apr 26, 2024

System and IINA version:

Expected behavior:
The Audio delay setting on the AUDIO tab of the quick settings panel is displayed as intended in languages other than English.

Actual behavior:
The Audio delay setting contains a text field after the slider that can be used to enter a value for the delay. After the text field is another text field giving the units of the value. In English this field shows s. Currently IINA does not support any right to left languages. However PR #4922 enables Hebrew. If you build IINA with that pull request and set Hebrew as the language then the units (שנ') do not fit:
delay

This problem was reported by @ShlomoCode in issue #4776. As that issue reports quite a few RTL related problems I have created this issue to focus just on this particular problem.

Steps to reproduce:

  • Pull PR feat: enable hebrew locale #4922

  • Open the IINA project in Xcode

  • Under the Product menu open the Scheme menu and select Edit Scheme…

  • Click on the Options tab

  • Scroll down to the App Language setting

  • In the pull down select Hebrew

  • Start IINA running under Xcode

  • Start playing a video

  • Press ⇧⌘A to show the audio panel

  • Notice the units shown for Audio delay is wrapped into multiple lines

  • MPV does not have this problem.

mpv does not support localization.

How often does this happen?
Every time.

@low-batt
Copy link
Contributor Author

Analysis

My initial take was that s. It is not a letter or an abbreviation, but an International System of Units (SI) symbol. From the US Metric Association FAQ:

SI unit symbols are the same in all languages, as you can see on this nutrition label from Japanese snack cakes.

That suggested the error was that IINA was presenting this label to translators instead of making it universal across all languages. However as shown here usage of SI symbols is not common practice in some locals. Therefore IINA should allow translators to specify the text to use in this case. Thus the layout problem needs to be corrected.

Fixing

The solution is to change the Line Break attribute of the text field cell from Word Wrap to something else.

low-batt added a commit that referenced this issue Apr 27, 2024
This commit will change the Line Break attribute of the text field
holding the units from Word Wrap to Truncate Tail.
@low-batt low-batt linked a pull request Apr 27, 2024 that will close this issue
2 tasks
@low-batt low-batt linked a pull request Apr 27, 2024 that will close this issue
2 tasks
@low-batt
Copy link
Contributor Author

With the proposed fix the audio delay setting controls now look like:
he-audio-delay-fixed

@ShlomoCode
Copy link

ShlomoCode commented Apr 27, 2024

After further thought, the abbreviation "שנ'" is not commonly used in Hebrew, so it seems to me that it is better to translate it as "שניות". I consulted about this with some local colleagues who also thought so. After changing the translation there is a problem even with this PR:

CleanShot 2024-04-27 at 22 44 38@2x

Can you fix it? Maybe you should narrow the width of the number input?

@low-batt
Copy link
Contributor Author

When I tested it the text field holding the number automatically reduced it's size. The results shown are unexpected. I will investigate.

@low-batt
Copy link
Contributor Author

Changing the units to be larger and setting the language to be Right-to-Left Pseudolanguage I see this:
en-audio-delay-6

The text field shrank to allow space for the units string. All seems to be working fine. But when I change the language to be Hebrew I see this:
he-audio-delay-broken

Not quite the same as the screenshot you posted, but something is clearly broken. Not obvious to me what is causing this. Will continue to investigate.

@ShlomoCode
Copy link

The second image you uploaded looks pretty good, I don't understand how. I even tested on a clean MacOS VM and it looked like this:
CleanShot 2024-04-28 at 03 26 52@2x

low-batt added a commit that referenced this issue Apr 29, 2024
This commit will change the Line Break attribute of the text field
holding the units from Word Wrap to Clip.
@low-batt
Copy link
Contributor Author

I experimented a lot, but was unable to reproduce the behavior shown in your screenshot:
he-audio-clip

I did update the code to clip instead of truncate to match the behavior of the other labels. Make certain your QuickSettingsViewController.xib has the lineBreakMode set for 1VY-EN-1mi:

<textFieldCell key="cell" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="s" id="1VY-EN-1mi">

I found the 0s (kan-bp-QDi) and 5s (Kt8-Kg-i2O) labels have not been setup to be translated (missing from the en translations). I assume you had to add those directly to the he strings file? I believe these first have to be added to the en file, pushed to Crowdin and changed there. We will need to coordinate with @uiryuu on this.

I did confirm that some other languages also do not use the SI symbol:

Translations:
low-batt@gag iina (he-audio-delay *$%=)$ grep -inr --include \*.strings '1VY-EN-1mi.title' *
iina/de.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/ur.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/he.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "שנ'";
iina/ar.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "ث";
iina/el.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/zh-Hans.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "秒";
iina/ja.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "秒";
iina/fa.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "ثانيه";
iina/mk.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/eu.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/en.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/uk.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = " с";
iina/kn.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/en-GB.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/es.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/is.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/sl.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/da.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/it.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "i";
iina/bg.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/sk.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/sr-Latn.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/sr.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/be.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/ta.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/ne.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/ml.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/sv.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "sek";
iina/cs.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/ko.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "초";
iina/hy.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/zh-Hant.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "秒";
iina/no.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/hu.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "mp";
iina/tr.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "sn";
iina/pl.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/pt-BR.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/vi.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "g";
iina/lv.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "sekundēm";
iina/ru.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "с";
iina/af.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/fr.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/fi.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/id.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "dtk";
iina/nl.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "sec";
iina/th.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/pt.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/bn.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/ug.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/ro.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/hr.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";
iina/hi.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "सै.";
iina/ca.lproj/QuickSettingViewController.strings:5:"1VY-EN-1mi.title" = "s";

@ShlomoCode
Copy link

ShlomoCode commented Apr 30, 2024

Sorry, I just noticed that I took a image of "subtitle delay" and you only fixed "audio delay"...

Confirms that audio delay seems normal:
CleanShot 2024-04-30 at 23 59 29@2x

But when I shrink the window it is not possible to see a decimal number:
CleanShot 2024-05-01 at 00 00 36@2x
Do you have an idea how to solve this?

@low-batt
Copy link
Contributor Author

low-batt commented May 1, 2024

Yes. I will fix that. It will mean the label will get clipped instead of the box with the number when the window is really compressed.

low-batt added a commit that referenced this issue May 3, 2024
This commit will:
- Change the Line Break attribute of the text field holding the units
  from Word Wrap to Clip
- Add a width constraint to the text field displaying slider setting as
  a numeric value
- Change the width constraint of the similar text field on the SUBTITLES
  tab to match the new constraint added to the AUDIO tab

This prevents the audio delay units field from wrapping into two lines
and places a limit on the minimum size of the text field displaying the
slider value such that the number it holds is not truncated when the
user reduces the window size so much that the quick settings panel is
compressed.
@low-batt
Copy link
Contributor Author

low-batt commented May 3, 2024

I have fixed both the AUDIO and SUBTITLES tabs to not truncate the number when the panel is compressed. But I do not like that the units ends up right next to the field. Looks a bit ugly. However we have reached the limit of my GUI abilities. I will leave the PR as a draft. Will need one of the other developers to tweak this to look better when compressed.

@ShlomoCode
Copy link

To clarify the progress in the meantime, this is how it is currently in a large window (it's perfect):
CleanShot 2024-05-03 at 06 59 28@2x

And this is in a quarter window (it's a little ugly but usable):
CleanShot 2024-05-03 at 06 58 53@2x

If there would be a way not to omit part of the label even in a quarter window, that would be perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants