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

Correct input from other langauges to English #776

Closed
thedrow opened this issue Jan 23, 2018 · 7 comments
Closed

Correct input from other langauges to English #776

thedrow opened this issue Jan 23, 2018 · 7 comments

Comments

@thedrow
Copy link
Contributor

thedrow commented Jan 23, 2018

This happens to me way too often, my keyboard is set to another language and I type something in the terminal.
I'd like the fuck command to map the characters I typed in another language to English according to the keyboard's layout.

@Harkishen-Singh
Copy link

@thedrow , can u please mention your Operating System along with its version?
If its Ubuntu or any Linux distro, then i guess, unless the error pointed out by the terminal is in that language, "fuck" cannot process that piece of code.

@thedrow
Copy link
Contributor Author

thedrow commented Jan 24, 2018

My OS is Ubuntu 17.10.
If I type something in another language other than English I get:

בלה
בלה: command not found

@thedrow
Copy link
Contributor Author

thedrow commented Jan 24, 2018

Actually if you'll redefine the command_not_found_handle() function in the shell you'll be able to hijack those events.

This is the output of type command_not_found_handle:

command_not_found_handle () 
{ 
    if [ -x /usr/lib/command-not-found ]; then
        /usr/lib/command-not-found -- "$1";
        return $?;
    else
        if [ -x /usr/share/command-not-found/command-not-found ]; then
            /usr/share/command-not-found/command-not-found -- "$1";
            return $?;
        else
            printf "%s: command not found\n" "$1" 1>&2;
            return 127;
        fi;
    fi
}

@nvbn
Copy link
Owner

nvbn commented Jan 24, 2018

We already have switch_lang rule, you just need to add your language to https://github.com/nvbn/thefuck/blob/master/thefuck/rules/switch_lang.py#L6

@thedrow
Copy link
Contributor Author

thedrow commented Jan 25, 2018

@nvbn What do I do if the target language doesn't have any capital letters?

thedrow added a commit to thedrow/thefuck that referenced this issue Jan 25, 2018
@nvbn
Copy link
Owner

nvbn commented Jan 25, 2018

@thedrow what happens when you press shift+letter?

@thedrow
Copy link
Contributor Author

thedrow commented Jan 25, 2018

@nvbn I get all caps English letters.

@nvbn nvbn closed this as completed in #778 Jan 29, 2018
nvbn pushed a commit that referenced this issue Jan 29, 2018
* Added hebrew the list of keyboard layouts.

Fixes #776.

* Added tests for hebrew layout.

* Fix test.

* Make lint happy.
riley-martine pushed a commit to riley-martine/thefuck that referenced this issue Dec 7, 2023
* Added hebrew the list of keyboard layouts.

Fixes nvbn#776.

* Added tests for hebrew layout.

* Fix test.

* Make lint happy.
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

No branches or pull requests

3 participants