readthedocs / readthedocs.org

The source code that powers readthedocs.org
https://readthedocs.org/
MIT License
7.92k stars 3.58k forks source link

Add support for all possible 'lang_COUNTRY' language codes #11417

Open hwhsu1231 opened 2 weeks ago

hwhsu1231 commented 2 weeks ago

What's the problem this feature will solve?

ReadTheDocs currently cannot handle some 'lang_COUNTRY' language codes. For example: zh_HK, zh_SG, en_US, en_GB, etc.

Describe the solution you'd like

Add support for all possible 'lang_COUNTRY' language codes.

Alternative solutions

Provide custom language codes for users to add, similar to the solution offered by Crowdin.

Additional context

Why I submit this issue

Recently, I have been researching the internationalization of Sphinx and its integration with ReadTheDocs. I have some thoughts on the language code handling.

First of all, based on this issue from the sphinx-doc/sphinx repository, it appears that:

Let's take Chinese as an example. Currently, ReadTheDocs supports only the following 3 locales:

This means that even if I create and maintain translation files for zh_HK and zh_SG, ReadTheDocs cannot handle these locales when deployed.

Secondly, let's consider the following examples for reference:

Although their language selectors typically display only the language name without specifying the country/region, the language codes in their URLs include the country/region code. This suggests that some languages are so representative of their regions that they do not need specific regional markers.

Lastly, based on this documentation of Transifex, we can see that it is suggested to use 'lang_COUNTRY' codes to represent a language.

Our first suggestion would be to be as precise as possible and use a full locale property (e.g., “fr_FR”) instead of just a generic language (e.g., “fr”). It supports alternate spellings, date formats, and other differences between countries with a shared language.

Therefore, I hope/suggest that ReadTheDocs be able to support all possible 'lang_COUNTRY' language codes.

humitos commented 2 weeks ago

Thanks for your suggestion. We will consider this next time we jump into translations work.