gettext-rs icon indicating copy to clipboard operation
gettext-rs copied to clipboard

Doesnt work as expected on windows

Open snoweuph opened this issue 10 months ago • 5 comments

Hi, Ive build it on Windows with msvc (in a vm) and I can do the following:

PS C:\Users\Windoofer\Desktop\rpg> $env:TEXTDOMAINDIR="res/locale"
PS C:\Users\Windoofer\Desktop\rpg> gettext.exe -d app app-name
Berichtshefte Generator

But the translations with gettext lib only return the translation key. the exact same code works just fine under linux.

Is there anything that i can do to debug where the problem in gettext-rs /gettext-sys lies?

snoweuph avatar Jan 24 '25 05:01 snoweuph

Ive build it on Windows with msvc (in a vm)

That's super cool! Would you be able to help with #12? Like, describe the environment (what you had to install onto a fresh Windows) and the steps (the commands you ran to build it)? Or maybe even turning it into a CI config? :)

As for the problem at hand, I'd start with crates' test suites. What does cargo test --package gettext-sys say? What about cargo test --package gettext-rs?

Minoru avatar Jan 30 '25 18:01 Minoru

gonna give you the the commands i ran in the vm tommorow

snoweuph avatar Jan 30 '25 20:01 snoweuph

Live is full rn, I bookmarked this, going to get back to it when I have some time again, sry

snoweuph avatar Feb 10 '25 15:02 snoweuph

Interresting, I can't even reproduce the manual usage of gettext in powersehll in a Windows vm anymore..

Going to have to do more debugging.

snoweuph avatar Mar 08 '25 22:03 snoweuph

Right now I'm using msys2 gettext which works fine, but I will have to drop msyw2, because its dlls for gtk won't work when outside, because they use / for svg resolution.

So yea, I'm going to have to switch to gvsbuild, and it might be that their gettext was acting different.

I'm going to come back here and report the results of my findings. Also going to try gettext from gnu-win32 and see how it behaves

snoweuph avatar Mar 13 '25 09:03 snoweuph

I actually just compiled with gvsbuild + cargo-xwin

exe: (check "llvm-ar") (check "cargo-xwin") (check "unzip") gvs
    #!/usr/bin/env sh
    rm -rf tmp
    mkdir -p tmp

    unzip gvs.zip -d tmp/gvs

    LIBS="tmp/gvs-vulkan"
    DIST="tmp/dist"

    cp -r tmp/gvs $LIBS
    llvm-ar crv $LIBS/lib/vulkan.lib
    llvm-ar crv $LIBS/lib/vulkan-1.lib

    PKG_CONFIG_ALLOW_CROSS=1 \
    Lib="$LIBS/lib" \
    PATH="$LIBS/bin:$PATH" \
    PKG_CONFIG_PATH="$LIBS/pkgconfig" \
    GETTEXT_DIR="$LIBS" \
    cargo-xwin build \
    --target x86_64-pc-windows-msvc \
    --release
    mkdir -p $DIST
    mv tmp/gvs $DIST/gvs
    cp target/x86_64-pc-windows-msvc/release/report-book-generator.exe $DIST/rpg.exe
    cp -r res $DIST/res
    cat > tmp/start.bat << 'EOF'
    @echo off
    set GVS=%~dp0gvs
    set PATH=%GVS%\bin;%PATH%
    set PKG_CONFIG_PATH=%GVS%\lib\pkgconfig
    set LIB=%GVS%\lib;%LIB%
    set INCLUDE=%GVS%\include;%INCLUDE%
    set LANG=de
    "%~dp0rpg.exe"
    EOF

gvs: (check "wget")
    [ -f gvs.zip ] || wget -q -O gvs.zip https://github.com

and im running into the same problem. again.

The lookup doesnt seem to work on windows

snoweuph avatar Oct 27 '25 11:10 snoweuph

I really have no idea why it doesn't work, but here's a couple suggestions:

  1. instead of relying on the environment variable, hard-code the path into the bindtextdomain call and see if that works
  2. I bet Windows has something similar to strace — a tool that shows the system calls that a program makes. Try running your program with that tool and see what directories it scans; that might give us more ideas.

Minoru avatar Nov 02 '25 12:11 Minoru