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

Support other languages/locales than English #32

Closed
tuxayo opened this issue Apr 18, 2015 · 11 comments
Closed

Support other languages/locales than English #32

tuxayo opened this issue Apr 18, 2015 · 11 comments

Comments

@tuxayo
Copy link

tuxayo commented Apr 18, 2015

I was searching why it was no giving a fuck when I was trying to use it.
Then I saw this PR:
https://github.com/nvbn/thefuck/pull/30/files

It seems that thefuck is checking for hard coded errors messages so obviously it can't work with other languages than English and the current approach can't allow it.

Any idea how to detect permission errors in a language agnostic way?
For git it should be possible to use the last line of the ouput which contains only the corrected command and nothing language specific.

@vikstrous
Copy link
Contributor

I think it would be cool to use strace for detecting permission issues. It's still a heuristic, but it might be better.

Example:

> strace cat /etc/shadow 2>&1 | grep EACCES
open("/etc/shadow", O_RDONLY)           = -1 EACCES (Permission denied)

@tuxayo
Copy link
Author

tuxayo commented Apr 18, 2015

Good idea.
Can someone try with apt? With pacman it can't see EACCES with strace.

@vikstrous
Copy link
Contributor

Yeah, I looked through the pacman strace and there's really nothing useful there. I wonder how it knows that you are not root. In any case, another possibility is to check that the command starts with pacman and returns 1.

@nvbn
Copy link
Owner

nvbn commented Apr 18, 2015

Is it repeats with 1.11+?

@AmarOk1412
Copy link

To complete this issue. I suggest to translate the "fuck" alias. Indeed, for example, in french, "putain" can be a better alias.
Can we translate the "fuck" alias in other languages?

@qrqiuren
Copy link
Contributor

Currently thefuck actually supports other languages. Because it is executed in environment with LANG=C, that means it only has to detect English strings in multilingual environment.

@AmarOk1412 It's quite simple, just add your own alias to your shell's configuration (e. g. ~/.bashrc):
alias putain='fuck'
I have used tmd (stands for tā mā de in Chinese) as an alias to fuck, it works well.

@AmarOk1412
Copy link

@Dugucloud. Yeap I know. I was just thinking about an automatic alias based on the computer language :). But it's not a very good idea.

@nvbn
Copy link
Owner

nvbn commented Apr 25, 2015

@AmarOk1412 anyone can use use whatever they want for an alias.

@nvbn nvbn closed this as completed Apr 25, 2015
@tuxayo
Copy link
Author

tuxayo commented Apr 25, 2015

Is it repeats with 1.11+?

@nvbn What does this means? I didn't understood.

Because it is executed in environment with LANG=C

@Dugucloud Where did you found that? I have to change manually my locale back to english to make thefuck work

@nvbn
Copy link
Owner

nvbn commented Apr 27, 2015

@tuxayo I mean that you need to upgrade thefuck:

sudo pip install thefuck --upgrade

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

6 participants
@vikstrous @nvbn @AmarOk1412 @tuxayo @qrqiuren and others