Skip to content

Few changes to allow the support of right to left languages - #658

Draft
Amr Barghouthi (AmrBarghouthi) wants to merge 3 commits into
Ultimaker:mainfrom
AmrBarghouthi:Right-to-left-support
Draft

Few changes to allow the support of right to left languages#658
Amr Barghouthi (AmrBarghouthi) wants to merge 3 commits into
Ultimaker:mainfrom
AmrBarghouthi:Right-to-left-support

Conversation

@AmrBarghouthi

@AmrBarghouthi Amr Barghouthi (AmrBarghouthi) commented Dec 5, 2020

Copy link
Copy Markdown

This to makes it possible to flip the image in RecolorImage which is needed for some icons when translating Apps to support Right to Left languages

@AmrBarghouthi Amr Barghouthi (AmrBarghouthi) changed the title Adding mirror property to RecolorImage Few changes to allow the support right to left languages Dec 7, 2020
@AmrBarghouthi Amr Barghouthi (AmrBarghouthi) changed the title Few changes to allow the support right to left languages Few changes to allow the support of right to left languages Dec 7, 2020
@AmrBarghouthi

Copy link
Copy Markdown
Author

I added a function to indicate the language direction to be used in QML files
example use is adding the following to row layout elements parent

LayoutMirroring.enabled: catalog.i18nIsRightToLeft()
LayoutMirroring.childrenInherit: true

@Ghostkeeper

Copy link
Copy Markdown
Contributor

I'm a bit confused as to why you would want to mirror images in right-to-left scripts?

And the solution of adding a translated string may not be very robust either. It would be better to get this from the metadata of the translation. I think gettext.info() can read that.

@AmrBarghouthi

Copy link
Copy Markdown
Author

GhostKeep image mirroring is going to be for stuff like arrows

as for metadata of the translation I will look into it

@AmrBarghouthi

Copy link
Copy Markdown
Author

I update it the i18nIsRightToLeft function to get the direction from language metadata
thanks Ghostkeeper for the suggestion

@Ghostkeeper

Copy link
Copy Markdown
Contributor

The only directional arrows that we have are really the folding arrows in the setting category headers. But those are not really related to any text, are they?

@AmrBarghouthi

Copy link
Copy Markdown
Author

yes but it's not only for arrows
for example
2020-12-04 (1)
these icons look way better when mirrored in right to left application
anyway it is a feature of Uranium that doesn't really do any harm if added

visible: false
sourceSize.width: parent.width
sourceSize.height: parent.height
layer.enabled: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change this to layer.enabled: mirror to save some rendering performance. These images are used a lot (e.g. with every setting) so performance is important.

@Ghostkeeper

Ghostkeeper commented Apr 12, 2021

Copy link
Copy Markdown
Contributor

I can't seem to be able to get this to work.

I added this property to the Dutch translation .po files (all 4):

"Language-Direction: rtl\n"

Alternatively I also tried without the newline and space, in case that mattered (though I think Gettext filters that out):

"Language-Direction:rtl"

I then recompiled the .po files to .mo files and printed the isRightToLeft() function from QML:

print(catalog.i18nIsRightToLeft());

However it still returns qml: false.

Setting the mirror property works, but setting it to depend on being right-to-left never mirrors the image.

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

Labels

PR: Community Contribution 👑 Community Contribution PR's

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants