fix missing flags in language selector#300
Open
Breno-Corsi wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix for Missing Flags in Language Selector
Description
In the language selector, flags for the following languages were missing:
Before Fix
The main issue was that the
translation.phpfile defined the flag path using a two-letter code, such as/lang/pt/flag.png. This created a problem because the path/lang/pt/flag.pngdid not exist; instead,/lang/pt_BR/flag.pngwas available.Additionally, the naming of directories within the
/langfolder was inconsistent. In some cases, the language code for the country was used, while in others, the locale code was employed. Examples of directories included:/lang/de/lang/pt_BRThis inconsistency often occurs in countries that have multiple variations for a language.
After Fix
Solution
The proposed solution involves adjusting the paths to utilize the locale code instead of the language code. This change means that the folders containing the flags should be named according to the corresponding locale code.
These modifications will ensure the system functions correctly, displaying the flags as expected.
Why Not Change
localeMap.json?The
localeMap.jsonfile is generated automatically based on PySide6.QtCore, which suggests that the file is likely accurate. My main concern is with this section:Previously, we used "sr" and "sr_CS", but since CS is no longer officially recognized, it has been replaced by RS for Serbia and ME for Montenegro. Given that the Serbian and Montenegrin languages are very similar, we don't need to display both options.
Currently, this is causing the language selector to show two entries for Serbia, as illustrated in the image below:
A Small Concern
I've noticed that the URLs for languages are not set up to handle different countries sharing the same language code. For example, the page for Brazilian Portuguese uses this URL:
https://www.freecad.org/index.php?lang=pt. Wouldn't it be better to use the locale codes as well (pt-br and pt-pt) to properly distinguish between the variations of the languages?