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

Select the language based on pre-existing text (enhancement) #172

Closed
wants to merge 8 commits into from
Closed

Conversation

grv99
Copy link

@grv99 grv99 commented May 6, 2013

(Issue #97) Not completely ready.
It adds a 'range' of hex code points to every language listed in inputmethods.js.
Issue: on chrome, works only when the cursor is in text field and you change the tab, and return back to the same tab... strange. On IE, works well.

Tested with hindi, gujarati and punjabi.

Todo:

  • Add all the matched languages to selector menu.
  • Update the code point ranges for all the languages.
  • Use more characters from the text (currently only one character just before the cursor is used).

@Nikerabbit
Copy link
Member

I don't quite understand the use case for this? What improvement does this bring over reading the lang attribute of the element?

@andjc
Copy link

andjc commented Jun 13, 2013

A range of hex codepoints would be insufficient, in some languages it would be necessary to tave fairly sophisticated regexes or syllable inventories to clearly distinguish languages. Possiblly supplemented by dictionary lookups for comonly occuring wprds in each language.

To do it properly and extensobly would be difficult.

@grv99
Copy link
Author

grv99 commented Jun 17, 2013

@andjc , yes it would be insufficient to predict the language exactly, but what we can provide is the list of most probable languages in the menu, for quick selection.

Also, if there is only one language that uses the predicted script, we can select it by default

@Nikerabbit I guess, in many cases, lang attribute is not given by the developer. This enhancement can be an addition to the ime's intelligence in such cases.

@amire80
Copy link
Contributor

amire80 commented Jun 1, 2017

Sorry for such a long delay in replying! :(

I'm starting a personal project to go over the old issues and pull requests here, and try to merge or close them.

I actually quite like the general idea. It probably won't be very useful for Wikimedia sites, which is our main focus, because we do set the lang attribute almost everywhere on them, but it can be useful on other sites.

The explicit ranges may be a bit overkill, too. Perhaps, if the langdb from jquery.uls is available, we can rely on the writing system setting.

I'll take another look some time.

If anybody has the energy to rebase this in the meantime, it would be nice :)

@amire80
Copy link
Contributor

amire80 commented Dec 6, 2020

Cleaning up very old pull request. Please post a new one if you think it's still useful.

@amire80 amire80 closed this Dec 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants