Latest Posts

Topic: How to play with translation?

dreieck
Avatar
Topic Opener
Joined: 2018-08-25, 11:48
Posts: 72
OS: Artix GNU/Linux
Version: -git
Ranking
Likes to be here
Location: Germany
Posted at: 2018-09-05, 16:58

Hello again,

I can't get German translation in the game (I did not try other). It is listed, but the game stays English when I select it.

Neither with build 19 (binary from Arch Linux), nor with locally built development version (r8807).

(How) is it possible to activate translation?

Edited: 2018-09-05, 16:59

(empty signature.)

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2018-09-05, 18:21

Make sure that you compile with the translations switched on - the CMake switch is OPTION_BUILD_TRANSLATIONS. Otherwise, the translations won't be compiled.

We have this switch because there are many translation files, and allowing to skip them speeds up development.

If you run ./compile.sh -r, you will get a release build with translations and website binaries included, and you won't need to deal with the CMake settings yourself. Run ./compile.sh --help for further options.

If translations have been built properly and you still can't get them, we'll need to do some bug hunting.

Edited: 2018-09-05, 18:22

Busy indexing nil values

Top Quote
dreieck
Avatar
Topic Opener
Joined: 2018-08-25, 11:48
Posts: 72
OS: Artix GNU/Linux
Version: -git
Ranking
Likes to be here
Location: Germany
Posted at: 2018-09-05, 19:39

GunChleoc wrote:

Make sure that you compile with the translations switched on - the CMake switch is OPTION_BUILD_TRANSLATIONS. Otherwise, the translations won't be compiled.

We have this switch because there are many translation files, and allowing to skip them speeds up development.

If you run ./compile.sh -r, you will get a release build with translations and website binaries included, and you won't need to deal with the CMake settings yourself. Run ./compile.sh --help for further options.

If translations have been built properly and you still can't get them, we'll need to do some bug hunting.

"GunChleoc" wrote:

Make sure that you compile with the translations switched on - the CMake switch is OPTION_BUILD_TRANSLATIONS. Otherwise, the translations won't be compiled.

I have.

And after installation I also have under /usr/share/widelands/locale/ the directories ar, ast, bg, br, ca, cs, da, de, el, en_CA, en_GB, en_US, eo, es, et, eu, fa, fi, fr, fy, ga, gd, gl, he, hi, hr, hu, ia, id, ig, it, ja, jv, ka, ko, krl, la, lt, mr, ms, my, nb, nds, nl, nn, oc, pl, pt, pt_BR, ro, ru, rw, si, sk, sl, sr, sv, tr, uk, vi, zh_CN and zh_TW.

And they have content. E.g. for de:

There is a subdirectory LC_MESSAGES, containing the files map_the_green_plateau.wmf.mo, maps.mo, mp_scenario_island_hopping.wmf.mo, mp_scenario_smugglers.wmf.mo, scenario_atl01.wmf.mo, scenario_bar01.wmf.mo, scenario_bar02.wmf.mo, scenario_dummy.wmf.mo, scenario_emp01.wmf.mo, scenario_emp02.wmf.mo, scenario_emp03.wmf.mo, scenario_emp04.wmf.mo, scenario_fri01.wmf.mo, scenario_fri02.wmf.mo, scenario_tutorial01_basic_control.wmf.mo, scenario_tutorial02_warfare.wmf.mo, scenario_tutorial03_seafaring.wmf.mo, scenario_tutorial04_economy.wmf.mo, texts.mo, tribes.mo, tribes_encyclopedia.mo, widelands.mo, widelands_console.mo, widelands_editor.mo, win_conditions.mo and world.mo.

Build configuration is:

cmake -DCMAKE_BUILD_TYPE=Release \
        -DOPTION_BUILD_WEBSITE_TOOLS=ON \
        -DCMAKE_INSTALL_PREFIX=/usr/bin \
        -DWL_INSTALL_DATADIR=/usr/share/widelands \
        -DOPTION_ASAN=OFF \
        -DGETTEXT_MSGFMT_EXECUTABLE=/usr/bin/msgfmt \
        -DGETTEXT_MSGMERGE_EXECUTABLE=/usr/bib/msgmerge \
        -DICU_CONFIG_EXECUTABLE=/usr/bin/icu-config \
        -DOPTION_BUILD_TRANSLATIONS=ON \
        -DOPTION_GLEW_STATIC=OFF \
        -DOpenGL_GL_PREFERENCE=LEGACY \
        -DBUILD_TESTING=ON \
        -DCMAKE_C_FLAGS="" \
        -DCMAKE_CXX_FLAGS="" \
        -DCMAKE_EXE_LINKER_FLAGS="" \
        -DCMAKE_MODULE_LINKER_FLAGS="" \
        -DCMAKE_SHARED_LINKER_FLAGS="" \
        -DCMAKE_STATIC_LINKER_FLAGS="" \
        -DCMAKE_C_FLAGS_RELEASE="${CFLAGS} -DNDEBUG" \
        -DCMAKE_CXX_FLAGS_RELEASE="${CXXFLAGS} -DNDEBUG" \
        -DCMAKE_EXE_LINKER_FLAGS_RELEASE="${LDFLAGS}" \
        ..

(taken from Arch Linux AUR-package widelands-bzr, and manually adapted and enhanced. The -DWL_INSTALL_DATADIR and -DCMAKE_INSTALL_PREFIX were not touched by me.)

Edited: 2018-09-05, 19:40

(empty signature.)

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-09-05, 21:22

I am also on archlinux and can choose all languages. I compile with the compile script using command:

./compile.sh -a

This gives me a debug version with Website executables and all translations. What is the difference? How do you compile?


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
dreieck
Avatar
Topic Opener
Joined: 2018-08-25, 11:48
Posts: 72
OS: Artix GNU/Linux
Version: -git
Ranking
Likes to be here
Location: Germany
Posted at: 2018-09-05, 22:36

kaputtnik wrote:

I am also on archlinux and can choose all languages. I compile with the compile script using command:

~~~~ ./compile.sh -a ~~~~

This gives me a debug version with Website executables and all translations. What is the difference?

Didn't try ./compile.sh yet.

How do you compile?

Here my PKGBUILD (it's the one from aur/widelands-bzr with some adaptions):

#Maintainer: Gabriel Margiani (gamag) <gabriel _strange_curved_character_ margiani · ch>
#Contributor: matthiaskrgr <matthias · krueger _strange_curved_character_ famsike · de>

pkgname=widelands-bzr
pkgver=19+r8808
pkgrel=1
pkgdesc="A realtime strategy game with emphasis on economy and transport - development version"
arch=(i686 x86_64)
license=('GPL2')
depends=('glew' 'sdl2_image' 'boost-libs' 'sdl2_mixer' 'sdl2_ttf')
makedepends=('bzr' 'cmake' 'python'  'boost')
provides=("widelands=${pkgver}")
conflicts=('widelands' 'widelands-data')
url="http://wl.widelands.org"
changelog=changelog
source=("changelog")
sha1sums=('SKIP')
options+=('ccache')
epoch=1

# HACK: Use Prepare to make a lightweight checkout, since it is a little faster
# than a full branch, as pacman would do it.  If you have a better solution,
# just tell me.
prepare() {
    cd "$srcdir"

    if test -d "$pkgname/.bzr"; then
        cd "$pkgname"
        msg2 "Updating bzr checkout"
        bzr update
    else 
        # don't use lp: to avoid bzr asking for ssh passphrase to authenticate
        # on launchpad
        msg2 "Making lightweight checkout. This may take some time."
        bzr checkout --lightweight "http://bazaar.launchpad.net/~widelands-dev/widelands/trunk" "$pkgname"
    fi
}

build() {
    cd "$srcdir/$pkgname"

    test -d build/locale || mkdir -p build/locale
    test -e locale || ln -s build/locale

    cd build

    msg2 "Running cmake..."
    # if this failes on an existing build because of an mismatch of src and build cmake files, just delete build and try again.
    export CC="ccache gcc"
    export CXX="ccache g++"
    cmake -DCMAKE_BUILD_TYPE=Release \
        -DOPTION_BUILD_WEBSITE_TOOLS=ON \
        -DCMAKE_INSTALL_PREFIX=/usr/bin \
        -DWL_INSTALL_DATADIR=/usr/share/widelands \
        -DOPTION_ASAN=OFF \
        -DGETTEXT_MSGFMT_EXECUTABLE=/usr/bin/msgfmt \
        -DGETTEXT_MSGMERGE_EXECUTABLE=/usr/bib/msgmerge \
        -DICU_CONFIG_EXECUTABLE=/usr/bin/icu-config \
        -DOPTION_BUILD_TRANSLATIONS=ON \
        -DOPTION_GLEW_STATIC=OFF \
        -DOpenGL_GL_PREFERENCE=LEGACY \
        -DBUILD_TESTING=ON \
        -DCMAKE_C_FLAGS="" \
        -DCMAKE_CXX_FLAGS="" \
        -DCMAKE_EXE_LINKER_FLAGS="" \
        -DCMAKE_MODULE_LINKER_FLAGS="" \
        -DCMAKE_SHARED_LINKER_FLAGS="" \
        -DCMAKE_STATIC_LINKER_FLAGS="" \
        -DCMAKE_C_FLAGS_RELEASE="${CFLAGS} -DNDEBUG" \
        -DCMAKE_CXX_FLAGS_RELEASE="${CXXFLAGS} -DNDEBUG" \
        -DCMAKE_EXE_LINKER_FLAGS_RELEASE="${LDFLAGS}" \
        ..
        #-DCMAKE_C_FLAGS_RELEASE="-O2 -DNDEBUG" \
        #-DCMAKE_CXX_FLAGS_RELEASE="-O2 -DNDEBUG" \
        #-DCMAKE_EXE_LINKER_FLAGS_RELEASE="" \
        #..
    msg2 "Running make..."
    make
}

package() {
    cd  "$srcdir/$pkgname/build"
    make DESTDIR="$pkgdir" install

    cd "${srcdir}/${pkgname}"
    for _docfile in CREDITS ChangeLog; do
        install -D -v -m644 "${_docfile}" "${pkgdir}/usr/share/doc/widelands/${_docfile}"
    done
}

pkgver() {
    _get_build_ver() {
        grep -E -e '^[[:space:]]*#define[[:space:]]+VER_BUILD[[:space:]]+' "${srcdir}/${pkgname}/utils/win32/mingw/Widelands_win.h" | sed -E -e 's|^.*VER_BUILD[[:space:]]*||' | sed -E -e 's|[[:space:]]+.*$||'
    }

    _get_svn_rev() {
        cd "${srcdir}/${pkgname}"
        printf "%s" "$(bzr revno -q)"
    }

    _ver="$(_get_build_ver)"
    _rev="$(_get_svn_rev)"

    if [ -z ${_ver} ]; then
        error "Failed to determine build version. Aborting."
        return 11
    fi
    if [ -z ${_rev} ]; then
        error "Failed to determine bazaar revision. Aborting."
        return 12
    fi

    printf "%s" "${_ver}+r${_rev}"
}

(empty signature.)

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-09-06, 08:24

Just installed the binary (Version 19-13) from the official arch repo and setting a language works as expected for me. Don't know if the systems locale settings are relevant, but what is the output of

locale

?

I do not fully understand why you are using a PKGBUILD. I guess after completion you are installing the created package? Installing isn't necessary for running widelands after compilation (if you are using the compile script, which does some moving and linking of files automatically).


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-09-06, 08:57

Did now a test with widelands from the AUR and also no problems setting the language. So i guess it is something in your system what is making the problem.


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
dreieck
Avatar
Topic Opener
Joined: 2018-08-25, 11:48
Posts: 72
OS: Artix GNU/Linux
Version: -git
Ranking
Likes to be here
Location: Germany
Posted at: 2018-09-06, 11:43

On Thu, 06 Sep 2018 06:40:03 -0000, noreply@widelands.org wrote about "Forum New Post":

Just installed the binary (Version 19-13) from the official arch repo and setting a language works as expected for me. Don't know if the systems locale settings are relevant, but what is the output of

~~~~ locale ~~~~

It does say

LANG=C
LC_CTYPE=en_US.UTF8
LC_NUMERIC=C
LC_TIME=C
LC_COLLATE=C
LC_MONETARY=C
LC_MESSAGES=C
LC_PAPER=de_DE.UTF8
LC_NAME=C
LC_ADDRESS=C
LC_TELEPHONE=C
LC_MEASUREMENT=C
LC_IDENTIFICATION=C
LC_ALL=

and it is deliberately set this way.

Since there is a menu within the game, it should adapt the language even if the environment variables defining default language are different.

I do not fully understand why you are using a PKGBUILD. I guess after completion you are installing the created package? Installing isn't necessary for running widelands after compilation (if you are using the compile script, which does some moving and linking of files automatically).

I want to install it properly using my package management, and not just having files lingering around somewhere or even been installed without passing through package management.

Did now a test with widelands from the AUR and also no problems setting the language. So i guess it is something in your system what is making the problem.

OK.

I just tried to start with LANG=de widelands and with LANG=de_DE widelands and with widelands --language=de_DE and with LANG=de widelands --language=de_DE and with LANG=de_DE widelands --language=de_DE (the command line option is suggested by widelands --help), no success either.

LANG=de_DE widelands --language=de_DE prints the following to the terminal:

This is Widelands Version bzr8808[trunk] (Release)
Set home directory: /home/<my_username>/.widelands
Adding directory: /usr/share/widelands
selected language: de_DE
using locale de_DE
Graphics: Try to set Videomode 1280x800
[...]

It detects the setting of the variable LANG=de_DE and of --language=de_DE, since the terminal outputs are correspondingly:

LANG=de_DE widelands:

This is Widelands Version bzr8808[trunk] (Release)
Set home directory: /home/<my_username>/.widelands
Adding directory: /usr/share/widelands
selected language: de_DE
using locale de_DE
Graphics: Try to set Videomode 1280x800
[...]

widelands --language=de_DE:

This is Widelands Version bzr8808[trunk] (Release)
Set home directory: /home/<my_username>/.widelands
Adding directory: /usr/share/widelands
selected language: de_DE
using locale de_DE
Graphics: Try to set Videomode 1280x800
[...]

It also seems to detect that de_DE is a valid language, since setting something unsupported:

E.g. widelands --language=tg:

This is Widelands Version bzr8808[trunk] (Release)
Set home directory: /home/<my_username>/.widelands
Adding directory: /usr/share/widelands
selected language: tg
No corresponding locale found - trying to set it via LANGUAGE=tg, LANG=tg
Graphics: Try to set Videomode 1280x800
[...]

When I start with LANG=de_DE widelands and in the game I go to Options -> Interface and select Language: Try system Language and click Apply, it displays The translation into Deutsch is complete. So it really honours LANG=de_DE. It also displays this text if I select Language: Deutsch manually from the menu.

But still everything stays in English.

If not specifying any language with an environment variable or command line option, it honours what was last set in the game options, since it prints to the termial also the lines

selected language: de
using locale de_DE

But still everything stays English.

I did try, to test, with Dansk. Also everything stays English.

Hm.

EDIT: And, my widelands-bzr-package installs the following files: [File list] (Text file, size: 4.1M) ([xz-compressed], size: 140k)

* --
Wählt man eine der Antworten zu dieser Frage zufällig aus, wie hoch ist die Wahrscheinlichkeit, dass sie korrekt ist?

a) 1/3
b) 1/3
c) sonstige, und zwar: ____ *

Edited: 2018-09-06, 11:57

(empty signature.)

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-09-06, 16:51

Have you tried to uninstall completly and checked for remaining files/folders and reinstall afterwards? If that doesn't work, i have no idea... sorry.


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-09-06, 17:02

Forgotten:

I want to install it properly using my package management, and not just having files lingering around somewhere or even been installed without passing through package management.

The compile script does not install anything. The only files it moves around are the executables and it creates a symbolic link. All those files are moved/created into the folder where you ran the script. This is quite convenient, because you can just delete the folder and all files are deleted although. But i guess your goal is something else.


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote