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

Extra spaces in page translation #15

Open
eson57 opened this issue Aug 28, 2022 · 10 comments
Open

Extra spaces in page translation #15

eson57 opened this issue Aug 28, 2022 · 10 comments

Comments

@eson57
Copy link
Contributor

eson57 commented Aug 28, 2022

Hi,

Working on Swedish translation I found these extra spaces in translation. Don't know if it's a bug in your code or in Qt-Linguist compiler/lrelease.

Screen_20220828_001
Screen_20220828_002

@nephros
Copy link
Collaborator

nephros commented Aug 28, 2022

thanks for looking at this.

these spaces come from the QML text layouter, as the labels are set to justified text.
as the long word can't be propely broken, the previous line gets those long spaces.

justification could be changed to right alignment, but that would make the text look bad (ragged right) elsewhere.

another option would be to set the word wrapping to "anywhere" but that would introduce breaks in the middle of a word which also looks bad :/

@nephros
Copy link
Collaborator

nephros commented Aug 28, 2022

does it look better if you remove all the hard line breaks(\n) from the translated strings?

@eson57
Copy link
Contributor Author

eson57 commented Aug 28, 2022

No, it doesn't. Most extra spaces remain.

@nephros
Copy link
Collaborator

nephros commented Aug 29, 2022

Ah gotta love germanic languages and their looong words ;)

I just learned about &shy; and <wbr> tags in HTML - I'll try whether they work in QML. That would be the most elegant solution, allowing translators to specify how words may be broken.

@nephros
Copy link
Collaborator

nephros commented Aug 29, 2022

Ah gotta love germanic languages and their looong words ;)

I just learned about &shy; and <wbr> tags in HTML - I'll try whether they work in QML. That would be the most elegant solution, allowing translators to specify how words may be broken.

Ah, those two do not work, but &#173; does.

@eson57 How does it look if you call it fellrapportings&#173;verktyget, and add a &#173; wherever a long word may be broken?

@eson57
Copy link
Contributor Author

eson57 commented Aug 30, 2022

Didn't work to well.

Screen_20220830_001

@eson57
Copy link
Contributor Author

eson57 commented Aug 30, 2022

I can fix the extra spaces by adding line breaks, like below, but it is not so elegant and I am sure I shouldn't have to do that. It will also change by screen size/resolution. I know it is okay on other translations that I have made. I'll try to find an example later today.

Screen_20220830_002 Screen_20220830_003

@nephros
Copy link
Collaborator

nephros commented Aug 30, 2022

This is so weird.

I use vim to edit everything, and I can enter the literal &#173; or &#x00AD; representation.

Compiling this with lrelease makes the soft-hypens work as expected. (So both the .qm file and the QML engine support this).

As soon as I run lupdate, the &somethings; are not displayed in vim any more - but they are still there! So lrelease converts them to the actual unicode characters, which vim in unicode display mode does not display :)

Still, a .qm file compiled from that works!

Can you reproduce this?

I seem to remember you use qtlinguist to edit, apparently that escapes the &somethings; into a literal string, otherwise they would not show up like in your screenshot.

@eson57
Copy link
Contributor Author

eson57 commented Aug 30, 2022

Ok, I did use qtlinguist so I'll try with lrelease instead., but something came up so I'll have to postpone everything until tomorrow.

@eson57
Copy link
Contributor Author

eson57 commented Aug 31, 2022

Well, it works like you said, but it does so for the word 'felrapportingsverktyget' only. I can't put an hyphen on all to long words because it violates the Swedish writing rules, and that would look really bad.

I took a look at some other translations that I made, and I think they are all using right alignment, so maybe you should do it anyway?

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

No branches or pull requests

2 participants