Skip to content

Globalize:Provide Bidi structured text support to MessageFormat #599

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

Closed
wants to merge 2 commits into from

Conversation

ashensis
Copy link

As per discussion in #539 (comment)
this PR is based on corresponding feature been recently introduced in SlexAxton/messageFormatter.js
(see messageformat/messageformat#129)
It provides an ability to enforce Bidi structured text in message being formatted by using Unicode Bidi control characters. The upgrading qualities are:

Prevents intermingling of text contained in placeholders with the rest of message text.
Maintains the integrity of Bidi text flowing according to directionality of language script. For reference to Bidi structured text see: http://cldr.unicode.org/development/development-process/design-proposals/bidi-handling-of-structured-text

QUnit.test( "should support Bidi structured text", function( assert ) {
assert.equal(
Globalize( "he" ).messageFormatter( "helloArray", true )( "Beethoven", "Mozart" ),
"\u05e9\u05dc\u05d5\u05dd, \u200FBeethoven\u200F & \u200FMozart\u200F"
Copy link
Member

Choose a reason for hiding this comment

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

Can we replace \u05e9\u05dc\u05d5\u05dd with real characters like שלום and do the same for all other visual characters?

Copy link
Author

Choose a reason for hiding this comment

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

But this involves changing corresponding files to Unicode format, would you mind this?

Copy link
Member

Choose a reason for hiding this comment

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

It's already utf-8 to me, so no problem. cc/ @jzaefferer for confirmation.

Copy link
Author

Choose a reason for hiding this comment

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

Strange, on Windows if one saves some file as having either Unicode or utf-8 encoding using Notepad, it adds special BOM characters at the beginning, and I do not se any in
message-formatter.js
But, after all, having sample of Hebrew or Arabic text isn't important that much, so I can just use English in this test file.

Copy link
Member

Choose a reason for hiding this comment

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

So please leave it as is. I can do this change later.

@rxaviers
Copy link
Member

@ashensis much better 😄

I left a couple of comments, please just let me know if you have any questions.

@tomerm
Copy link

tomerm commented Mar 22, 2016

Leaving a dummy comment to assure future automatic notifications on this PR.

@ashensis
Copy link
Author

Hi @rxaviers
I did requested changes, could you please have a look.

@rxaviers
Copy link
Member

rxaviers commented Jul 18, 2016

Thanks for the contribution so far. There are remaining work that needs to be done before we merge this PR into master, which have been addressed in #623 as a continuation of this PR.

This PR is going to be continued in #623. Closing the latter in favor of the former.

@rxaviers rxaviers closed this Jul 18, 2016
rxaviers added a commit that referenced this pull request Jul 18, 2016
rxaviers added a commit that referenced this pull request Jul 18, 2016
nkovacs pushed a commit to nkovacs/globalize that referenced this pull request May 15, 2017
nkovacs pushed a commit to nkovacs/globalize that referenced this pull request May 15, 2017
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

Successfully merging this pull request may close these issues.

4 participants