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

Add support for setting text part language #8989

Closed
Mgsy opened this issue Feb 4, 2021 · 11 comments · Fixed by #9074
Closed

Add support for setting text part language #8989

Mgsy opened this issue Feb 4, 2021 · 11 comments · Fixed by #9074
Assignees
Labels
domain:rtl This issue reports a problem with support for right-to-left languages. domain:v4-compatibility This issue reports a CKEditor 4 feature/option that's missing in CKEditor 5. type:feature This issue reports a feature request (an idea for a new functionality or a missing option).

Comments

@Mgsy
Copy link
Member

Mgsy commented Feb 4, 2021

📝 Provide a description of the new feature

Add support for setting text part language, similar to CKEditor 4 language feature.


If you'd like to see this feature implemented, add a 👍 reaction to this post.

@Mgsy Mgsy added type:feature This issue reports a feature request (an idea for a new functionality or a missing option). domain:rtl This issue reports a problem with support for right-to-left languages. domain:v4-compatibilty labels Feb 4, 2021
@Mgsy
Copy link
Member Author

Mgsy commented Feb 4, 2021

Related: #2008

@Reinmar
Copy link
Member

Reinmar commented Feb 4, 2021

@Reinmar Reinmar added this to the nice-to-have milestone Feb 4, 2021
@niegowski
Copy link
Contributor

We could simplify configuration by automatically detecting dir like we do it for uiLanguageDirection and contentLanguageDirection: https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/locale.js#L183-L185

@Mgsy Mgsy modified the milestones: nice-to-have, iteration 41 Feb 11, 2021
@neongreen
Copy link

@niegowski

We could simplify configuration by automatically detecting dir

Do you mean that if the user types some text in Hebrew or Arabic, it will automatically be laid out right-to-left even if the rest of the editor content is left-to-right?

Or that the whole editor content will be either right-to-left or left-to-right based whether the majority of the text is in one of the RTL langs or not?

@niegowski
Copy link
Contributor

Do you mean that if the user types some text in Hebrew or Arabic, it will automatically be laid out right-to-left even if the rest of the editor content is left-to-right?

I just meant the language code to "dir" mapping.

@jacekbogdanski jacekbogdanski self-assigned this Feb 17, 2021
@hadifarnoud
Copy link

I should be able to change a paragraph's direction as needed. it can detect paragraphs direction based on first percentage of text in LTR or RTL language.

or simply, a LTR/RTL button that allow me to change text direction as needed.

@Reinmar
Copy link
Member

Reinmar commented Feb 24, 2021

There's a question that appeared while working on #9074 whether the default tittle of the default configuration of this dropdown have to be translated automatically.

IMO, no. It makes no sense as the entire config is there just for showcase purposes. It makes this feature work before someone configures this plugin. But the plugin needs to be configured anyway as the list of 4 options is just completely arbitrary and will not make any sense in 99% of cases.

@Reinmar
Copy link
Member

Reinmar commented Feb 24, 2021

The other question that appeared is the name of this feature:  https://github.com/ckeditor/ckeditor5/pull/9074/files#r580836210. I find the current name "language" too vague and thus confusing. config.language will add to that as it may be understood as the language of the editor.

Therefore, I'm for something more concrete as "text language". cc @wwalc @AnnaTomanek

@Reinmar
Copy link
Member

Reinmar commented Feb 25, 2021

  • We should consider the name of the plugin. Should it be changed from Language to avoid collision with language property. LanguageText language?
  • There's config.language already. It's used to set UI and content languages.
  • The new feature is a new package and config of packages land in config.<packageName> hence we have a clash here.
  • If we'd rename this package name to avoid the clash, we'd have config.textLanguage which would still make a clash between config.language.content and config.textLanguage (content ≠ text wtf???).
  • Also, we expect to have more features related to language support (e.g. bidi blocks, some automatic recognition, unicode language marks, mirroring icons depending on the text dir under caret). Ideally, they should all be developed in one package (separate plugins, in one package). Thus, the more general name of this package, the better.
  • Hence, let's go with ckeditor5-language and TextFragmentLanguage plugin in it, and add this plugin's options to config.language object.

@Reinmar Reinmar added domain:v4-compatibility This issue reports a CKEditor 4 feature/option that's missing in CKEditor 5. and removed domain:v4-compatibilty labels Mar 9, 2021
niegowski added a commit that referenced this issue Mar 16, 2021
Feature (language): Added language dropdown button to support text part language. Closes #8989.

Other (utils): Added `language.getLanguageDirection` helper function allowing to determine text direction based on language code.

Internal (locale): Language text direction detection moved to the `language` utils module.
@wimleers
Copy link

Where can we screenshots/screencasts of this in action? https://ckeditor.com/blog/ckeditor-5-v26.0.0-with-extensible-builds-inline-widget-styling-and-annotations-guides/ made me curious to see how the CKEditor 5 implementation compares with the CKEditor 4 one 🤓

@AnnaTomanek
Copy link
Contributor

AnnaTomanek commented Mar 25, 2021

Hi @wimleers, thanks for your interest 👋

The guide is work in progress, it should be merged tomorrow at the latest. The release blog post is due next Wednesday. The feature itself is available in version 27.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:rtl This issue reports a problem with support for right-to-left languages. domain:v4-compatibility This issue reports a CKEditor 4 feature/option that's missing in CKEditor 5. type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants