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

option to stick to western numerals in foreign input methods[ENHANCEMENT] #60

Open
itt533 opened this issue Jul 4, 2023 · 16 comments
Open
Assignees

Comments

@itt533
Copy link

itt533 commented Jul 4, 2023

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

when selecting an indic input method like 'hindi', 'telugu', one automatically
gets numerals too in those languages. Most of these people have adopted
the western numerals, therefore there should be an option allowing or
disabling the chosen language numerals. That is how it is in latex, and libreoffice

Describe the solution you'd like
A clear and concise description of what you want to happen.

There should be an option locking numerals to western only

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
ibus-typing booster recently implement this feature

@itt533 itt533 changed the title option to stick towestern numerals in foreign input methods[ENHANCEMENT] option to stick to western numerals in foreign input methods[ENHANCEMENT] Jul 4, 2023
@mike-fabian
Copy link

@fujiwarat just requested to add a direct input mode to ibus-m17n, which is somewhat related to your request.

See: #59

But I believe you don't want to press a key to switch to direct input mode each time you want to type western digits and then switch back to “normal” input mode where you would get for example Devanagari letters and Devanagari digits.

I believe you want to stay in Devanagari (Or Telugu, Tamil, whatever...) input mode and lock the digits to western digits so you always get Devanagari letters but Western digits without having to press any special key to switch to Western digits.

I.e. you want something exactly like the feature I recently implemented in ibus-typing-booster. But why not just use ibus-typing-booster then? It has more features anyway. Is there any particular reason why you want to use ibus-m17n instead of ibus-typing-booster?

If you don't need the extra features ibus-typing-booster offers and want just very simple input of an Indian langauge without suggesting word completions, you can switch off almost all of the extras in ibus-typing-booster and make it behave almost exactly like ibus-m17n. This chapter of the documentation shows how to do this:

Simulate the behaviour of ibus-m17n: https://mike-fabian.github.io/ibus-typing-booster/docs/user/#2_2_1_1

If you do that, you have something which behaves like ibus-m17n and still has the option in the setup tool to use only western numerals.

@mike-fabian
Copy link

By the way, which Indian m17n input methods are you personally using?

In ibus/ibus#2530 (comment) you mentioned “hindi”, “telugu”, “itrans”, “inscript telugu”.

Which ones exactly are you using? Are you using inscript or inscript2? Or are you using itrans? Or both? And for which languages?

@itt533
Copy link
Author

itt533 commented Jul 6, 2023

those i'm using are telugu-itrans and sanskrit-itrans. I have been using for long time telugu-inscript and hindi-inscript and i don't think i'll be back to inscript.

The way ibus-typing-booster is implemented looks like an improved ibus in ibus. Since ibus interface is heavily buggy i thought it would add as many new problems.

Can't you make of ibus-typing-booster an independent program replacing ibus? ibus does not seem to be actively maintained, and there are too many weird problems to report.

@fujiwarat
Copy link
Member

ibus does not seem to be actively maintained, and there are too many weird problems to report.

Don't mistake each engine problem and ibus core problelm.
Your patches are denied because your program is not good as I mentioned.

@fujiwarat
Copy link
Member

But I believe you don't want to press a key to switch to direct input mode each time you want to type western digits and then switch back to “normal” input mode where you would get for example Devanagari letters and Devanagari digits.

I don't say it.
The bug is still valid since ibus-typing-booster cannot be default.

@mike-fabian
Copy link

Can't you make of ibus-typing-booster an independent program replacing ibus? ibus does not seem to be actively maintained, and there are too many weird problems to report.

No, that isn’t possible, ibus-typing-booster cannot be an independent program.

I think Fujiwara San maintains ibus well and if you really have problems with the core of ibus, open an issue, Fujiwara San will surely help you.

As Fujiwara San says, some problems are in the ibus core, some are in the engines, for a normal user this might be confusing and it might not be always obvious for a normal user whether it should be reported agains an ibus engine or against ibus core.

@mike-fabian
Copy link

@itt533 I have something for you to test.

Please download this file: https://mfabian.fedorapeople.org/misc/te-itrans-itt533.mim

Create a ~/.m17n.d/ directory in your home directory if it does not yet exist. Place the downloaded file in that directory. Should look like this:

mfabian@hathi:~/.m17n.d
$ ls te-itrans-itt533.mim 
te-itrans-itt533.mim
mfabian@hathi:~/.m17n.d
$ 

Restart ibus:

$ ibus restart

Now when checking which engines ibus knows about, there should be a new one called te-itrans-itt533. Like this:

mfabian@hathi:~/.m17n.d
$ ibus list-engine | grep itt533
  m17n:te:itrans-itt533 - te-itrans-itt533 (m17n)
mfabian@hathi:~/.m17n.d
$

If using Gnome, open the Gnome control centre and search for that engine and add it.

If not using Gnome, use ibus-setup to add that engine.

Should look like this in ibus-setup:

Screenshot-ibus-setup-te-itrans-itt533

Switch to that engine and open the setup tool of that ibus-m17n engine. Click on the "Advanced” tab. Should look like this:

Screenshot-m17n-setup-tool-ascii-digits-option

By default, the ascii-digits option should be 0. If it is 0, this engine will produce Telugu digits. If you change that option to 1, this engine will produce ASCII digits.

You can also use that engine in ibus-typing-booster. After adding it in the ibus-typing-booster setup tool it looks like this:

Screenshot-ibus-typing-booster-te-itrans-itt533

Select that engine and click on the Hammer and Wrench icon 🛠️. Should look like this:

Screenshot-ibus-typing-booster-te-itrans-itt533-ascii-digits-option

Here you can choose between 0 and 1 to select whether this input method should produce ascii digits or language specific (i.e. Telugu) digits.

I like that system, it requires to apply that change to each of the Indian m17n input methods, but it is a very easy, straigthforward and very safe change.

And it makes it possible to select the digit style even in ibus-typing-booster for each input method seperately.

The already existing option

☑️ Convert language specific digits to ASCII digits

is still useful if you want to switch it globally for all input methods with a single switch. And also if you want to change that option from time to time because changing that option can be bound to a key in the keybindings tab of the ibus-typing-booster setup tool.

But having such an option in each engine is also a very good thing I believe. It makes it possible for example to choose that you want ASCII digits in te-itrans but not in hi-itrans for example.

@mike-fabian
Copy link

I like that additional option and I think I would like to add that option to all Indian m17n input methods.

Very easy, very safe change, also easy to use.

@mike-fabian
Copy link

Here I compare the original /usr/share/m17n/te-itrans.mim with my improved ~/.m17n.d/te-itrans-itt533.mim, shows that the change is very straightforward:

mfabian@hathi:~/.m17n.d
$ diff -u /usr/share/m17n/te-itrans.mim ./te-itrans-itt533.mim
--- /usr/share/m17n/te-itrans.mim       2023-04-26 12:19:35.000000000 +0200
+++ ./te-itrans-itt533.mim      2023-07-06 15:03:38.921415598 +0200
@@ -21,7 +21,7 @@
 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 ;; Boston, MA 02110-1301, USA.

-(input-method te itrans)
+(input-method te itrans-itt533)

 (description "Telugu input method by ITRANS transliteration.
 For the detail of ITRANS, see the page:
@@ -30,6 +30,12 @@

 (title "క")

+(variable
+ (ascii-digits
+  (_"If this variable is 0 (the default), this input method uses Telugu digits.
+If this variable is 1, ASCII digits are produced.")
+  0 0 1)) ; ((NAME [DESCRIPTION DEFAULT-VALUE VALID-VALUE ...])
+
 (map
  (starter
   (".") ("~") ("#") ("$") ("^") ("*") ((S-\ )) ((C-@))
@@ -122,30 +128,50 @@
   ("H" "ః")
   (".h" "్")                            ; not in ITRANS Telugu table
   ;; (".a" "ఽ")                                ; not in Unicode 4.1
-  ("0" "౦")
-  ("1" "౧")
-  ("2" "౨")
-  ("3" "౩")
-  ("4" "౪")
-  ("5" "౫")
-  ("6" "౬")
-  ("7" "౭")
-  ("8" "౮")
-  ("9" "౯")
+  ("0" (cond ((= ascii-digits 0) "౦")
+             ((= ascii-digits 1) "0")))
+  ("1" (cond ((= ascii-digits 0) "౧")
+             ((= ascii-digits 1) "1")))
+  ("2" (cond ((= ascii-digits 0) "౨")
+             ((= ascii-digits 1) "2")))
+  ("3" (cond ((= ascii-digits 0) "౩")
+             ((= ascii-digits 1) "3")))
+  ("4" (cond ((= ascii-digits 0) "౪")
+             ((= ascii-digits 1) "4")))
+  ("5" (cond ((= ascii-digits 0) "౫")
+             ((= ascii-digits 1) "5")))
+  ("6" (cond ((= ascii-digits 0) "౬")
+             ((= ascii-digits 1) "6")))
+  ("7" (cond ((= ascii-digits 0) "౭")
+             ((= ascii-digits 1) "7")))
+  ("8" (cond ((= ascii-digits 0) "౮")
+             ((= ascii-digits 1) "8")))
+  ("9" (cond ((= ascii-digits 0) "౯")
+             ((= ascii-digits 1) "9")))
   ("#" "్ర")                            ; not in ITRANS Telugu table
   ("$" "ర్")                            ; not in ITRANS Telugu table
   ("^" "త్ర")                           ; not in ITRANS Telugu table
   ("*" "శ్ర")                           ; not in ITRANS Telugu table
-  ((KP_1) "౧")
-  ((KP_2) "౨")
-  ((KP_3) "౩")
-  ((KP_4) "౪")
-  ((KP_5) "౫")
-  ((KP_6) "౬")
-  ((KP_7) "౭")
-  ((KP_8) "౮")
-  ((KP_9) "౯")
-  ((KP_0) "౦")
+  ((KP_1) (cond ((= ascii-digits 0) "౧")
+                ((= ascii-digits 1) "1")))
+  ((KP_2) (cond ((= ascii-digits 0) "౨")
+                ((= ascii-digits 1) "2")))
+  ((KP_3) (cond ((= ascii-digits 0) "౩")
+                ((= ascii-digits 1) "3")))
+  ((KP_4) (cond ((= ascii-digits 0) "౪")
+                ((= ascii-digits 1) "4")))
+  ((KP_5) (cond ((= ascii-digits 0) "౫")
+                ((= ascii-digits 1) "5")))
+  ((KP_6) (cond ((= ascii-digits 0) "౬")
+                ((= ascii-digits 1) "6")))
+  ((KP_7) (cond ((= ascii-digits 0) "౭")
+                ((= ascii-digits 1) "7")))
+  ((KP_8) (cond ((= ascii-digits 0) "౮")
+                ((= ascii-digits 1) "8")))
+  ((KP_9) (cond ((= ascii-digits 0) "౯")
+                ((= ascii-digits 1) "9")))
+  ((KP_0) (cond ((= ascii-digits 0) "౦")
+                ((= ascii-digits 1) "0")))
   ((S-\ ) "‌")                          ; not in ITRANS Telugu table
   ((C-@) "‍"))                          ; not in ITRANS Telugu table

mfabian@hathi:~/.m17n.d
$ 

I like that solution.

@fujiwarat
Copy link
Member

Very easy, very safe change, also easy to use.

Probably I don't understand it. Fixing it in ibus-m17n is not so hard but safe for me. I think you need to keep the old engine names for the ibus-setup compatibility at least and I also wonder increasing the engine names would even confuse users. And this way might be different between ibus-typing-booster and ibus-m17n.
But I don't disagree with your way and it would help users until several ibus-m17n enhancements will be done.

I think asking volunteers can be an idea if the C language enhancements are difficult for @mike-fabian before my resources are used for ibus-m17n.

@itt533
Copy link
Author

itt533 commented Jul 7, 2023

@mike-fabian i tested your new method te-itrans-itt533.mim. It works well. Anyway i had to restart ibus after setting the 'ascii-digit' option to 1. Since today i have no use at all of telugu digits it's fine. But in the case of sanskrit i use mainly the sanskrit digits and might from time to time need the ascii digits. Therefore i think the best would be to setup a keyboard shortcut like Shift+Super+space to cycle through the available digit scripts. Most of the time it would only be a choice between 2 scripts, i.e. the local one, and ascii one. Super+space is the default shortcut to cycle trough the list of input methods.

@mike-fabian
Copy link

I think you need to keep the old engine names for the ibus-setup compatibility at least and I also wonder increasing the engine names would even confuse users.

Yes, of course I would not change the engine names. The different engine name te-itrans-itt533 was just for the user @itt533 to test it. If I do that change, I would do it upstream in m17n and the engine names would not change, they would just get an additional option.

And this way might be different between ibus-typing-booster and ibus-m17n.

Both ibus-typing-booster and ibus-m17n can use these options in the engines in the same way.

But I don't disagree with your way and it would help users until several ibus-m17n enhancements will be done.

Yes, it is one additional way to do it which I think is also helpful. It does not mean that an option to switch the digits for all engines at once like ibus-typing-booster already has is useless, it is just another way to to it which is also useful in its own way. In ibus-typing-booster this gives more fine grained control, instead of using the global option for all engines, a user could choose to use ASCII digits for te-itrans but not for hi-itrans for example.

@mike-fabian
Copy link

But in the case of sanskrit i use mainly the sanskrit digits and might from time to time need the ascii digits. Therefore i think the best would be to setup a keyboard shortcut like Shift+Super+space to cycle through the available digit scripts.

In ibus-typing-booster you can do that. Shortly after I had implemented the new option

☑️ Convert language specific digits to ASCII digits

in ibus-typing-booster, I also added the command toggle_ascii_digits to switch that option using a key binding. You see that here in the setup tool:

Screenshot

By default it is not bound to any key. But you can bind this to any key you like to have a keyboard shortcut to switch between the language specific (Telugu, Sanskrit, ...) and the ASCII digits.

@mike-fabian
Copy link

@itt533 You could also use ibus-m17n for te-itrans and ibus-typing-booster with the key-binding to toggle the ASCII digits for Sanskrit if you like.

@itt533
Copy link
Author

itt533 commented Jul 16, 2023

I wanted to disable the small box that suggests words that it memorised, I checked "off the record", and deleted its dictionary and now it's fine. Isn't there any other way for that? Is there a way so that all input is done in real-time so that i don't need to hit space or an arrow key?

@mike-fabian
Copy link

I wanted to disable the small box that suggests words that it memorised, I checked "off the record", and deleted its dictionary and now it's fine. Isn't there any other way for that? Is there a way so that all input is done in real-time so that i don't need to hit space or an arrow key?

This chapter in the documentation:

Simulate the behaviour of ibus-m17n https://mike-fabian.github.io/ibus-typing-booster/docs/user/#2_2_1_1

describes the settings to use if one wants ibus-typing-booster to behave very close to ibus-m17n.

That is similar to what you did.

The small remaining difference to ibus-m17n is that a word is committed only after a space, Return, arrow key or something like that is typed. But that doesn't matter much, in fact it avoids several bugs which ibus-m17n has that characters typed disappear again or appear in a wrong order.

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

No branches or pull requests

3 participants