Dlaczego gra uruchamiana w konsoli jest w innym języku?

Witam.

Dużo można poczytać o korzyściach uruchamiania programów w konsoli.

Jednak ja trafiłem na przypadek gdzie gra uruchomiona w konsoli działa inaczej niż gdy jest uruchamiana z aktywatora.

Konkretnie chodzi mi o grę SuperTuxKart.

Jak uruchomię z aktywatora gra jest po polsku.

Natomiast jak uruchomię w konsoli poleceniem:

/usr/games/supertuxkart

Gra uruchamia się po angielsku.

 

Pytanie dlaczego tak się dzieje i czy jeszcze jakieś inne elementy gry nie są uruchamiane w inny sposób?

Pokaż zawartość aktywatora. 

[Desktop Entry]
Name=SuperTuxKart
Icon=/usr/share/pixmaps/supertuxkart_128.png
GenericName=A kart racing game
GenericName[de]=Ein Kart-Rennspiel
GenericName[fr]=Un jeu de karting
GenericName[gl]=Xogo de carreiras con karts
GenericName[ro]=Un joc de curse cu carturi
Exec=/usr/games/supertuxkart --no-console
Terminal=false
StartupNotify=false
Type=Application
TryExec=/usr/games/supertuxkart
Categories=Game;ArcadeGame;

Pokaż ~/.bashrc, ~/.profile, ~/.bash_profile

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
#[-x /usr/bin/lesspipe] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [-z "${debian_chroot:-}"] && [-r /etc/debian_chroot]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [-n "$force_color_prompt"]; then
    if [-x /usr/bin/tput] && tput setaf 1 >&/dev/null; then
	# We have color support; assume it's compliant with Ecma-48
	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
	# a case would tend to support setf rather than setaf.)
	color_prompt=yes
    else
	color_prompt=
    fi
fi

if ["$color_prompt" = yes]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [-x /usr/bin/dircolors]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    #alias grep='grep --color=auto'
    #alias fgrep='fgrep --color=auto'
    #alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [-f ~/.bash_aliases]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [-f /usr/share/bash-completion/bash_completion]; then
    . /usr/share/bash-completion/bash_completion
  elif [-f /etc/bash_completion]; then
    . /etc/bash_completion
  fi
fi

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [-n "$BASH_VERSION"]; then
    # include .bashrc if it exists
    if [-f "$HOME/.bashrc"]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [-d "$HOME/bin"] ; then
    PATH="$HOME/bin:$PATH"
fi

cat ~/.bash_profile
cat: /home/tom/.bash_profile: Nie ma takiego pliku ani katalogu

Korzystasz może ze środowiska KDE?

Tak. Korzystam z KDE.

Jeżeli korzystasz z KDE4, to sprawdź pliki w katalogu $HOME/.kde/env/ w poszukiwaniu ustawień języka. Możesz wkleić tutaj wszystkie pliki, choć nie wydaje mi się to problemem, bo kiedy uruchamiasz konsole, to powinnio one posiadać te same zmienne środowiskowe.

ls -hal $HOME/.kde/env/
razem 12K
drwxr-xr-x 2 tom tom 4,0K kwi 30 13:11 .
drwx------ 6 tom tom 4,0K mar 22 19:32 ..
-rw------- 1 tom tom 48 kwi 30 13:11 .directory

cat $HOME/.kde/env/.directory
[Dolphin]
Timestamp=2015,4,30,13,11,1
Version=3

W takim razie, to nie wiem, co jest nie tak. Uruchamiasz grę w programie Konsole? W takim razie Ustawienia -> Edytuj bieżący profil i tam klikasz w przycisk edytuj/edycja obok napisu środowisko.

Tak, uruchamiam grę w programie Konsola.

W miejscu o którym piszesz (Środowisko: Edytuj …) mam:

TERM=xterm

Wyjście z programu Konsola (język gry jest angielski) :

/usr/games/supertuxkart
Irrlicht Engine version 1.8.0
Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24) x86_64
[info] FileManager: Data files will be fetched from: '/usr/share/games/supertuxkart/'
[info] FileManager: User directory is '/home/tom/.config/supertuxkart/'.
[info] FileManager: Addons files will be stored in '/home/tom/.local/share/supertuxkart/addons/'.
[info] FileManager: Screenshots will be stored in '/home/tom/.cache/supertuxkart/screenshots/'.
[info] irr_driver: GLSL supported.
[info] NetworkHttp: Using cached addons.xml
[debug] main: Error messages and other text output will be logged to /home/tom/.config/supertuxkart//stdout.log.

Wyjście z świeżo zainstalowanego LXTerminal (język gry jest polski):

/usr/games/supertuxkart
Irrlicht Engine version 1.8.0
Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24) x86_64
[info] FileManager: Data files will be fetched from: '/usr/share/games/supertuxkart/'
[info] FileManager: User directory is '/home/tom/.config/supertuxkart/'.
[info] FileManager: Addons files will be stored in '/home/tom/.local/share/supertuxkart/addons/'.
[info] FileManager: Screenshots will be stored in '/home/tom/.cache/supertuxkart/screenshots/'.
[debug] translation: Env var LANGUAGE = 'pl_PL.UTF-8'.
[debug] translation: Language 'Polish (Poland)'.
Adding language fallback pl
[info] irr_driver: GLSL supported.
[info] NetworkHttp: Using cached addons.xml
[debug] main: Error messages and other text output will be logged to /home/tom/.config/supertuxkart//stdout.log.

Czy to oznacza że Konsola z KDE jest wybrakowana?

Pojęcia nie mam, co może być nie tak. Wyświetl zmienną PATH w obu emulatorach terminala

echo $PATH

Co ma $PATH do wiatraka? :smiley:

 

Pokaż w konsoli:

locale; echo $LANGUAGE

Path ma to do wiatraka, że program może korzystać z innego programu, uruchamiając go przez ścieżkę względną. W takim wypadku PATH ma wiele do sprawy. Mogą być zainstalowane dwie wersje np. supertuxcart.

Myślę, że szukasz dziury w całym ; ]

 

Po drugie - gdzie jest program sprawdzisz tak:

which supertuxkart

 

“Kto mnie wołał czego chciał” ;]

strace -e open supertuxkart

 

saturno

 

Sprawdź jeszcze:

evn | grep KDE
echo $PATH
/home/tom/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

locale; echo $LANGUAGE
LANG=pl_PL.UTF-8
LANGUAGE=
LC_CTYPE="pl_PL.UTF-8"
LC_NUMERIC="pl_PL.UTF-8"
LC_TIME="pl_PL.UTF-8"
LC_COLLATE="pl_PL.UTF-8"
LC_MONETARY="pl_PL.UTF-8"
LC_MESSAGES="pl_PL.UTF-8"
LC_PAPER="pl_PL.UTF-8"
LC_NAME="pl_PL.UTF-8"
LC_ADDRESS="pl_PL.UTF-8"
LC_TELEPHONE="pl_PL.UTF-8"
LC_MEASUREMENT="pl_PL.UTF-8"
LC_IDENTIFICATION="pl_PL.UTF-8"
LC_ALL=

which supertuxkart
/usr/games/supertuxkart

evn | grep KDE
bash: evn: nie znaleziono polecenia

env | grep KDE
KDE_MULTIHEAD=false
KDE_FULL_SESSION=true
KDE_SESSION_UID=1000
KDE_SESSION_VERSION=4
XDG_CURRENT_DESKTOP=KDE

Powyższe polecenia w obydwu terminalach są identyczne.

 

 

strace -e open supertuxkart (Konsola): http://wklej.org/id/1701787/

strace -e open supertuxkart (LXTerminal): http://wklej.org/id/1701795/

 

Z ważniejszych różnic w strace, to że w LXTerminal są dodatkowe linie:

[debug] translation: Env var LANGUAGE = 'pl_PL.UTF-8'.
[debug] translation: Language 'Polish (Poland)'.
open("/usr/share/games/supertuxkart/data/po//pl.po", O_RDONLY) = 4
Adding language fallback pl
open("/usr/share/games/supertuxkart/data/po//pl.po", O_RDONLY) = 4

Sprawdź co się stanie kiedy zmienisz na LC_ALL=C. To powinno wymusić na wszystkich programach użycie domyślnego języka.

 

Napisz konkretnie co mam zrobić i jak ewentualnie cofnąć tę operację, bo trochę szukałem tylko nie wiem czy w dobrym kierunku (nie chcę popsuć systemu):

 

https://wiki.debian.org/Locale

 

http://www.debian.pl/threads/28413-Debian-6-0-b%C5%82%C4%85d-aktualizacji-systemu?p=155350&viewfull=1#post155350

cd ~/Pulpi
bash: cd: /home/tom/Pulpi: Nie ma takiego pliku ani katalogu
tom@dhcppc0:~$ LC_ALL=C
tom@dhcppc0:~$ cd ~/Pulpi
bash: cd: /home/tom/Pulpi: No such file or directory
tom@dhcppc0:~$ supertuxkart
Irrlicht Engine version 1.8.0
Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24) x86_64
[info] FileManager: Data files will be fetched from: '/usr/share/games/supertuxkart/'
[info] FileManager: User directory is '/home/tom/.config/supertuxkart/'.
[info] FileManager: Addons files will be stored in '/home/tom/.local/share/supertuxkart/addons/'.
[info] FileManager: Screenshots will be stored in '/home/tom/.cache/supertuxkart/screenshots/'.
[info] irr_driver: GLSL supported.
[info] NetworkHttp: Using cached addons.xml
[debug] main: Error messages and other text output will be logged to /home/tom/.config/supertuxkart//stdout.log.

SuperTuxKart dalej po angielsku.

Uruchom SuperTuxCard w taki sposób:

LC_ALL=C supertuxkart
LC_ALL=C supertuxkart

Dalej jest angielski.