Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SwimmingTiger opened this issue Jun 29, 2022 · 8 comments · Fixed by #1693
Assignees

Comments

@SwimmingTiger
Copy link
Contributor

SwimmingTiger commented Jun 29, 2022

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: i18n: add regional variants of Chinese as symbolic links #1515

  4. But unfortunately, this commit was quickly overwritten by b91be85, 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
Copy link
Contributor Author

SwimmingTiger commented Jun 29, 2022

If a bot made the following changes, its behavior may need to be corrected: b91be85

@mirkobrombin
Copy link
Member

mirkobrombin commented Jul 3, 2022

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

@SwimmingTiger
Copy link
Contributor Author

SwimmingTiger commented Jul 3, 2022

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.

@mirkobrombin
Copy link
Member

mirkobrombin commented Jul 3, 2022

Should be doable

@mirkobrombin mirkobrombin added this to the 2022.7.14 milestone Jul 3, 2022
@mirkobrombin
Copy link
Member

mirkobrombin commented Jul 7, 2022

should be fixed by 9b7164a

@mirkobrombin
Copy link
Member

mirkobrombin commented Jul 8, 2022

Nvm, the problem is still there

@mxj4
Copy link

mxj4 commented Sep 26, 2022

@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 WeblateOrg/weblate@2e9c2bb
And the discussion at WeblateOrg/weblate#5522

@mirkobrombin
Copy link
Member

mirkobrombin commented Sep 26, 2022

I don't see those lang codes in weblate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo 🎈
Development

Successfully merging a pull request may close this issue.

3 participants