Skip to content

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

@SwimmingTiger

Description

@SwimmingTiger
Contributor

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

Activity

SwimmingTiger

SwimmingTiger commented on Jun 29, 2022

@SwimmingTiger
ContributorAuthor

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

mirkobrombin

mirkobrombin commented on Jul 3, 2022

@mirkobrombin
Member

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

moved this to In Progress ⏱ in Bresciaon Jul 3, 2022
SwimmingTiger

SwimmingTiger commented on Jul 3, 2022

@SwimmingTiger
ContributorAuthor

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

mirkobrombin commented on Jul 3, 2022

@mirkobrombin
Member

Should be doable

18 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

    Participants

    @mxj4@SwimmingTiger@mirkobrombin

    Issue actions

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