msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.31k stars 1.23k forks source link

opencc has issues with "zh_Hans" #22579

Closed Kreijstal closed 1 week ago

Kreijstal commented 1 week ago

Description / Steps to reproduce the issue

From https://github.com/flxzt/rnote/issues/1299

pacboy -S opencc:p
git clone --recursive https://github.com/flxzt/rnote.git
cd rnote
msgfmt -o crates/rnote-ui/po/rnote.mo crates/rnote-ui/po/zh_SG.po

Expected behavior

$ cat crates/rnote-ui/po/rnote.mo
□+D□l 8+9+O+g+
  □+□+□+□+
          □+□+□+□+$
                   ,0,4,␦I,
                           d,>p,9□,F□,:0-k-n-q-t-w-
□-□-□-                                             z-$□-2□-
      .
#.
  ..
:.E.
    X.d.□.□.□□.□□.□.□.□.□.□.□/
                              ///
                                 +/
                                   7DMV_/h/y/□□/□/#□/□/␦□/□/␦□/030

Actual behavior

$ msgfmt -o crates/rnote-ui/po/rnote.mo crates/rnote-ui/po/zh_SG.po
crates/rnote-ui/po/zh_SG.po:1: keyword "zh_Hans" unknown
crates/rnote-ui/po/zh_SG.po:1:8: syntax error
E:\msys64\ucrt64\bin\msgfmt.exe: found 2 fatal errors

Verification

Windows Version

MINGW64_NT-10.0-22631

MINGW environments affected

Are you willing to submit a PR?

Beyond me.

Biswa96 commented 1 week ago

This is not opencc or gettext issue but an issue of symlink in msys2. You can learn more about the behavior of symlink here https://www.msys2.org/docs/symlinks/

First, clone the git repository with MSYS=winsymlinks:native git clone --depth 1 https://github.com/flxzt/rnote.git command. That will create the symlinks correctly. Here are the list of those files.

$ find crates/rnote-ui/po/ -type l -exec file {} \;
crates/rnote-ui/po/zh_CN.po: symbolic link to zh_Hans.po
crates/rnote-ui/po/zh_HK.po: symbolic link to zh_Hant.po
crates/rnote-ui/po/zh_SG.po: symbolic link to zh_Hans.po
crates/rnote-ui/po/zh_TW.po: symbolic link to zh_Hant.po

Now, msgfmt will work correctly.

$ msgfmt -o crates/rnote-ui/po/rnote.mo crates/rnote-ui/po/zh_SG.po && echo $?
0
Kreijstal commented 1 week ago

Ahh how could I have missed that, thank you.