MegaAntiCheat / MegaAntiCheat-UI

React frontend
GNU General Public License v3.0
45 stars 26 forks source link

Changing languages doesn't update some strings #53

Open megascatterbomb opened 9 months ago

megascatterbomb commented 9 months ago

Affected areas include the tooltips on the sidebar and the friends api usage dropdown in preferences.

image

image

MonokumaBear commented 8 months ago

The issue seems to be that the select element doesn't update the value it's displaying when the language changes, and only updates when the user changes its selected value. I tried fixing it with React state hooks, but couldn't get it to work. Hopefully someone who knows React can fix it. The placeholder for the select element also uses Select instead of t('COMPONENT_SELECT').

Also, for some languages, the possible values displayed in the dropdown also don't update. This is because the following entries don't exist in some of the translation files in the i18n directory besides en_US.json:

PREF_FRIEND_API_USAGE_ALL
PREF_FRIEND_API_USAGE_CHEATERS_ONLY
PREF_FRIEND_API_USAGE_NONE

These need to be added by translators.

The t() function defaults to English if the entries don't exist, so that causes the values to be in English. I'll make a pull request that makes the t() function log a warning if an entry doesn't exist for a string in a given language.