Page MenuHomePhabricator

Allow callbacks also to make more complex replacements
Closed, DeclinedPublic

Description

Author: junu.pv+public

Description:
Currently Narayam allow only string as the third item in a rule for replacement. If callback functions are also allowed it will be possible to do more complex replacements.


Version: unspecified
Severity: enhancement

Details

Reference
bz35457

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:13 AM
bzimport set Reference to bz35457.
bzimport added a subscriber: Unknown Object (MLST).

What's a feature without a use case? Please provide a reason why.

junu.pv+public wrote:

Submitted the change code changes for this feature:
https://gerrit.wikimedia.org/r/3694

Waiting for review and merge.

(In reply to comment #1)

What's a feature without a use case? Please provide a reason why.

One use case: people want to convert/create Unicode character from its code number.
For example, by typing '\u0D05\' it should be converted to 'അ'. Please see the code change for Malayalam transliteration in the commit, that function implements it.

Also callbacks can be used to combine several rules those share some behavior.

While writing the rules for some languages, I had met with rules that would have more tuned if this feature used. So this feature was in my mind from almost beginning of Narayam but just now only it got implemented.

(In reply to comment #2)

Submitted the change code changes for this feature:
https://gerrit.wikimedia.org/r/3694

Waiting for review and merge.

(In reply to comment #1)

What's a feature without a use case? Please provide a reason why.

One use case: people want to convert/create Unicode character from its code
number.
For example, by typing '\u0D05\' it should be converted to 'അ'. Please see the
code change for Malayalam transliteration in the commit, that function
implements it.

hexcode based inputting does not seem to be a valid usecase here. It is very advanced and it is for people know the hexcode of characters.

['\\\\u([0-9a-fA-F]{4})\\\\', '', narayam_ml_unicode_char_convert], // use callback
Here the conversion is nothing specific to Malayalam, because we allow any 4 character length hexcodes. Moreover the length 4 rule is unnecessary.

All operating systems allow direct unicode inputting. See http://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_code_input. In Gnome, I can type using hexadecimal characters by control+shift+ u + <hexcode>.

Also callbacks can be used to combine several rules those share some behavior.

I agree here. Do you have any patters where this can be used?

junu.pv+public wrote:

(In reply to comment #3)

hexcode based inputting does not seem to be a valid usecase here. It is very
advanced and it is for people know the hexcode of characters.

It is not a necessary to have there.

Also callbacks can be used to combine several rules those share some behavior.

I agree here. Do you have any patters where this can be used?

That I have to examine over the existing rulesets.

Anyway the callback feature is a must have in Narayam. Its implementation, programming logic, method signature can be tuned.

I am trying to revive this feature, at least for bugs like Bug 31904 and Bug 32029.

Junaid: Are you still working on this? If not, please reset this bug report's ASSIGNED status and/or the assignee person. Thanks!

junu.pv+public wrote:

No, I am not. OK, I am resetting assignee to default.

Not planning to add this feature to Narayam. Already added to jquery.ime