Skip to content

fix missing flags in language selector#300

Open
Breno-Corsi wants to merge 1 commit into
FreeCAD:mainfrom
Breno-Corsi:main
Open

fix missing flags in language selector#300
Breno-Corsi wants to merge 1 commit into
FreeCAD:mainfrom
Breno-Corsi:main

Conversation

@Breno-Corsi

Copy link
Copy Markdown

Fix for Missing Flags in Language Selector

Description

In the language selector, flags for the following languages were missing:

  • svenska
  • 中文
  • español
  • português
  • српски (this one is duplicated)

Before Fix

Before Fix

The main issue was that the translation.php file 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.png did not exist; instead, /lang/pt_BR/flag.png was available.

Additionally, the naming of directories within the /lang folder 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_BR

This inconsistency often occurs in countries that have multiple variations for a language.

After Fix

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.json file is generated automatically based on PySide6.QtCore, which suggests that the file is likely accurate. My main concern is with this section:

"sr": "sr_RS",
"sr_RS": "sr_RS"

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:

image

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?


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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants