Bottles icon indicating copy to clipboard operation
Bottles copied to clipboard

[Bug]: zh_CN/zh_HK/zh_SG/zh_TW have been removed from LINGUAS, making the Chinese translation unusable

Open SwimmingTiger opened this issue 2 years ago • 6 comments

Describe the bug

  1. zh_Hans and zh_Hant are not language codes actually used in Linux desktop.

  2. zh_CN/zh_HK/zh_SG/zh_TW are the language codes actually used in Linux desktop, where CN/SG use Hans, and HK/TW use Hant.

  3. I created symlinks for them and added the actual used language code to LINGUAS, after this PR, the Chinese translation can be actually used: https://github.com/bottlesdevs/Bottles/pull/1515

  4. But unfortunately, this commit was quickly overwritten by https://github.com/bottlesdevs/Bottles/commit/b91be850ced8f47de8df1506ae41e8e3f109e0b4, zh_CN/zh_HK/zh_SG/zh_TW was removed from LINGUAS, and the Chinese translation is again unavailable to actual users.

To Reproduce

  1. Switch to any Chinese locale.

  2. Run Bottles.

  3. Bottles are not loaded with Chinese translation.

  4. Run this command:

    env | grep LANG
    

    You may get one of the following codes:

    LANGUAGE=zh_CN
    LANGUAGE=zh_HK
    LANGUAGE=zh_SG
    LANGUAGE=zh_TW
    

    You have no chance of getting the following code:

    LANGUAGE=zh_Hans
    LANGUAGE=zh_Hant
    
  5. Run this command:

    cat /etc/locale.gen | grep zh
    

    You will get:

    #lzh_TW UTF-8  
    #zh_CN.GB18030 GB18030  
    #zh_CN.GBK GBK  
    #zh_CN.UTF-8 UTF-8  
    #zh_CN GB2312  
    #zh_HK.UTF-8 UTF-8  
    #zh_HK BIG5-HKSCS  
    #zh_SG.UTF-8 UTF-8  
    #zh_SG.GBK GBK  
    #zh_SG GB2312  
    #zh_TW.EUC-TW EUC-TW  
    #zh_TW.UTF-8 UTF-8  
    #zh_TW BIG5
    

    And zh_Hans and zh_Hant are not among them.

  6. Therefore, it is meaningless to keep only zh_Hans and zh_Hant in LINGUAS for actual Chinese users, we need zh_CN/zh_HK/zh_SG/zh_TW also in it.

Package

Flatpak from Flathub

Distribution

Arch linux

Health Check

Version: 2022.6.28-brescia
Display:
    X.org: true
    X.org (port): :99.0
    Wayland: false
Graphics:
    vendors:
        nvidia: &id002
            vendor: nvidia
            envs:
                __NV_PRIME_RENDER_OFFLOAD: '1'
                __GLX_VENDOR_LIBRARY_NAME: nvidia
                __VK_LAYER_NV_optimus: NVIDIA_only
            icd: /usr/lib/x86_64-linux-gnu/GL/vulkan/icd.d/nvidia_icd.json:/usr/lib/i386-linux-gnu/GL/vulkan/icd.d/nvidia_icd.json
        amd: &id001
            vendor: amd
            envs:
                DRI_PRIME: '1'
            icd: /usr/lib/x86_64-linux-gnu/GL/vulkan/icd.d/radeon_icd.x86_64.json:/usr/lib/i386-linux-gnu/GL/vulkan/icd.d/radeon_icd.i686.json
    prime:
        integrated: *id001
        discrete: *id002
Kernel:
    Type: Linux
    Version: 5.17.9-arch1-1
Distro:
    Name: GNOME
    Version: '"42 (Flatpak runtime)"'
Disk:
    Total: 33444196352
    Free: 33444040704
RAM:
    MemTotal: 62.3GiB
    MemAvailable: 57.8GiB
Tools:
    cabextract: true
    p7zip: true
    patool: true
    glibc_min: '2.33'
Bottles_envs: null

Display Protocol

X11

Display Backend used by Bottles

X11

Additional context

No response

SwimmingTiger avatar Jun 29 '22 07:06 SwimmingTiger

If a bot made the following changes, its behavior may need to be corrected: https://github.com/bottlesdevs/Bottles/commit/b91be850ced8f47de8df1506ae41e8e3f109e0b4

SwimmingTiger avatar Jun 29 '22 08:06 SwimmingTiger

Weblate keep breaking because of this. Since those are just symlinks, we should add them at build instead. I have to figure out how to do this. Currently adding them to the LINGUAS file will break every language due to weblate not handling the locales and only supports zh_Hans and zh_Hant

mirkobrombin avatar Jul 03 '22 08:07 mirkobrombin

Consider using a wrapper script to modify environment variables at runtime:

#!/bin/sh
replace_lang() {
    lang="${1/zh_CN/zh_Hans}"
    lang="${lang/zh_SG/zh_Hans}"
    lang="${lang/zh_HK/zh_Hant}"
    lang="${lang/zh_TW/zh_Hant}"
    echo "$lang"
}

export LANGUAGE="$(replace_lang "$LANGUAGE")"
export LANG="$(replace_lang "$LANG")"

exec real-bottles "$@"

Then you can undo my changes and remove those symlinks.

If environment variable substitution in python code is applicable, that's fine too.

SwimmingTiger avatar Jul 03 '22 15:07 SwimmingTiger

Should be doable

mirkobrombin avatar Jul 03 '22 17:07 mirkobrombin

should be fixed by 9b7164ae0b3811fa8cfb026558264c149d245d6b

mirkobrombin avatar Jul 07 '22 10:07 mirkobrombin

Nvm, the problem is still there

mirkobrombin avatar Jul 08 '22 04:07 mirkobrombin

@mirkobrombin I took a brief look at this repo and weblate repo, it seems that somewhere on weblate side you can choose a different language format.

See the fix at https://github.com/WeblateOrg/weblate/commit/2e9c2bb84da86f40c152aa15854593d383be9c6c And the discussion at https://github.com/WeblateOrg/weblate/issues/5522

mxj4 avatar Sep 26 '22 17:09 mxj4

I don't see those lang codes in weblate

mirkobrombin avatar Sep 26 '22 19:09 mirkobrombin