Giter VIP home page Giter VIP logo

Comments (17)

soimort avatar soimort commented on May 21, 2024

Hi,

The regex /utf-?8$/ covered both utf-8 and utf8 - Please use the git version here, since the PKGBUILD on AUR is a bit outdated.

from translate-shell.

klingtnet avatar klingtnet commented on May 21, 2024

I forgot to say that I used the version from the stable branch, not the one in the AUR.

from translate-shell.

soimort avatar soimort commented on May 21, 2024

I see what's going on here - Please check out the develop branch. (the fix hasn't been merged into stable branch yet.)

from translate-shell.

klingtnet avatar klingtnet commented on May 21, 2024

Doesn't fix this, because the file from the develop branch also checks for LC_CTYPE which isn't set on any of my systems.

from translate-shell.

soimort avatar soimort commented on May 21, 2024

I can't reproduce this after unsetting my LC_CTYPE. Can you report the output of these?

$ echo $LC_TYPE
$ echo $LANG
$ grep `which trans` -e 'ENVIRON\["LC_CTYPE"\]'

from translate-shell.

klingtnet avatar klingtnet commented on May 21, 2024
# $ echo $LC_TYPE                                                                                                                                                                

# $ echo $LANG                                                                                                                                                                  
en_US.utf8

# $ grep ~/bin/trans -e 'ENVIRON\["LC_CTYPE"\]'                                                                                                                                 
UserLang = ENVIRON["LC_CTYPE"] ?
parseLang(ENVIRON["LC_CTYPE"]) :
if (ENVIRON["LANG"] !~ /UTF-8$/ && ENVIRON["LC_CTYPE"] !~ /UTF-8$/)

from translate-shell.

klingtnet avatar klingtnet commented on May 21, 2024
# $ echo $LC_CTYPE                                                                                                                                                              

from translate-shell.

soimort avatar soimort commented on May 21, 2024

Obviously you have not updated your ~/bin/trans. This line indicates that you're still using the outdated code:

if (ENVIRON["LANG"] !~ /UTF-8$/ && ENVIRON["LC_CTYPE"] !~ /UTF-8$/)

While the code in develop branch should be:

if (tolower(ENVIRON["LANG"]) !~ /utf-?8$/ && tolower(ENVIRON["LC_CTYPE"]) !~ /utf-?8$/)

To use the one from develop branch, run make build (the executable script should be generated in your build/)

from translate-shell.

klingtnet avatar klingtnet commented on May 21, 2024

translate-shell is a submodule of my dotfiles repo and I had set the branch of the submodule to develop but the module was still at the stable branch. Git submodules ... 🙈

Now it works.

from translate-shell.

pickfire avatar pickfire commented on May 21, 2024

I am using arch too, it has the same problem. I am using the develop branch of trans.

# $ echo $LC_TYPE                                                                                                                                                                

# $ echo $LANG                                                                                                                                                                  
en_GB.utf8

# $ grep -e 'ENVIRON\["LC_CTYPE"\]' $(which trans)
(ENVIRON["LC_CTYPE"] ? ENVIRON["LC_CTYPE"] :

from translate-shell.

soimort avatar soimort commented on May 21, 2024

@pickfire What's your problem? Command-line output? Version of trans?

from translate-shell.

pickfire avatar pickfire commented on May 21, 2024

trans --version

[WARNING] Your locale codeset (C) is not UTF-8.
Translate Shell 0.9-dev

gawk (GNU Awk)        4.1.2
fribidi (GNU FriBidi) 0.19.6
User Language         English (English)

trans 你好

[WARNING] Your locale codeset (C) is not UTF-8.

from translate-shell.

soimort avatar soimort commented on May 21, 2024

@pickfire Can you post the output of locale?
It seems one of your locale variable is set to 'C' (which often implies ASCII-only for most systems) and trans doesn't like it.

from translate-shell.

pickfire avatar pickfire commented on May 21, 2024

locale

LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES=C
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=

localectl

   System Locale: LANG=en_US.UTF-8
       VC Keymap: n/a
      X11 Layout: n/a

I had set one of the local variable to 'C' and I doesn't see any reason to disable that. (I doesn't know what does that that mean, I only know LANG)

from translate-shell.

soimort avatar soimort commented on May 21, 2024

@pickfire OK. Those LC_* variables are not so relevant for checking whether user's locale supports UTF-8 (they are mainly used for programs to determine in which language messages are shown). Your LANG (en_GB.UTF-8) has got it covered already.

Shall be fixed in the develop branch now.

from translate-shell.

pickfire avatar pickfire commented on May 21, 2024

Thanks.

from translate-shell.

pickfire avatar pickfire commented on May 21, 2024

After a few git pull, when I ran trans, it still shows the same output which is:

[WARNING] Your locale codeset (C) is not UTF-8.
[ERROR] Oops! Something went wrong and I can't translate it for you :(

from translate-shell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.