mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-16 05:43:54 +03:00
[PR #4679] [CLOSED] Use globalization for media stream language names #10229
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jellyfin/jellyfin/pull/4679
Author: @bilde2910
Created: 12/5/2020
Status: ❌ Closed
Base:
master← Head:full-language-name📝 Commits (10+)
7ae7608Prioritize locally localized language names4e27ad6Add localizations for language names39a413aApply suggestions from code reviewa694f57Remove unnecessary importsc781856Merge upstream changesf22dbb9Fix duplicated assignment555c28dAdd French translations of language names5cd21e0Capitalize LocalizedString to match conventionsefc66a2Fix missing capital47ce3eeFix missing capital📊 Changes
43 files changed (+6894 additions, -2 deletions)
View changed files
📝
Emby.Server.Implementations/Data/SqliteItemRepository.cs(+7 -0)📝
Emby.Server.Implementations/Localization/Core/af.json(+176 -0)📝
Emby.Server.Implementations/Localization/Core/bg-BG.json(+159 -0)📝
Emby.Server.Implementations/Localization/Core/bn.json(+184 -0)📝
Emby.Server.Implementations/Localization/Core/ca.json(+184 -0)📝
Emby.Server.Implementations/Localization/Core/cs.json(+173 -0)📝
Emby.Server.Implementations/Localization/Core/da.json(+138 -0)📝
Emby.Server.Implementations/Localization/Core/de.json(+184 -0)📝
Emby.Server.Implementations/Localization/Core/en-GB.json(+184 -0)📝
Emby.Server.Implementations/Localization/Core/en-US.json(+184 -0)📝
Emby.Server.Implementations/Localization/Core/eo.json(+184 -0)📝
Emby.Server.Implementations/Localization/Core/es.json(+184 -0)📝
Emby.Server.Implementations/Localization/Core/fi.json(+184 -0)📝
Emby.Server.Implementations/Localization/Core/fr-CA.json(+184 -0)📝
Emby.Server.Implementations/Localization/Core/fr.json(+184 -0)📝
Emby.Server.Implementations/Localization/Core/gl.json(+184 -0)📝
Emby.Server.Implementations/Localization/Core/hi.json(+184 -0)📝
Emby.Server.Implementations/Localization/Core/hr.json(+162 -0)📝
Emby.Server.Implementations/Localization/Core/hu.json(+137 -0)📝
Emby.Server.Implementations/Localization/Core/id.json(+173 -0)...and 23 more files
📄 Description
This change request concerns how Jellyfin translates ISO 639-2 language codes (e.g.
eng) to display names (e.g.English) when displaying media info. Jellyfin's current behavior as of 10.7.z is to use CultureInfo to resolve language names (first committed in #2773 and merged in #2788). The proposed change is to use Jellyfin's globalization infrastructure to handle this instead, and only using CultureInfo as a fallback when an unknown lanugage is encountered.The reasons for this change request is as follows:
DisplayNamethat appears to be locked to English. If a user changes their language in Jellyfin, they will still see English language names in the audio and subtitle selection boxes when viewing media in Jellyfin.sweis mapped toSwedish,danto Danish, butnordoes not have a mapping, and falls back to displaying "Nor" in Jellyfin.fre(B) vsfra(T)) and German (ger(B) vsdeu(T)).Using Jellyfin's globalization infrastructure allows to overcome all of these shortcomings of using CultureInfo. However, this approach also has some shortcomings:
To work around these shortcomings, I propose keeping the CultureInfo lookup mechanism as a fallback. If a language exists in Jellyfin globalization files, that value will be used for rendering the full language name. If it does not exist, Jellyfin will fall back to CultureInfo. If CultureInfo also fails, fall back to displaying the language code instead, as was the default in Jellyfin up to version 10.6.z.
Regarding the number of extra strings, I am willing to help out by importing the language names from some of the most commonly used languages from the ISO 639-1 tables on Wikipedia in Weblate. Most languages should have official lists of language names somewhere that could also possibly be used to aid this process.
The goal of this change request is to improve user experience regarding language selection for media in Jellyfin, making it more reliable than it currently is in English, and improving user experience by rendering language names in the user's native language for all other Jellyfin locales (where available).
Technical changes
LanguageXxxkeys have been added to globalization files whereXxxis the ISO 639-2/B code for the language in question. 185 such keys have been added.Languagewas used to avoid possible future conflicts, and to clearly group these together and indicate their purpose.SqliteItemRepository.csandProbeResultNormalizer.cswill look up this key using theLanguageattribute of theMediaStreamupon creation, and either set thelocalizedLanguageattribute of MediaStream to the localized name, or to null, depending on whether or not the language exists in globalization files.MediaStreamwill uselocalizedLanguageif it is non-null, and CultureInfo if null (fallback).Relevant issues/references
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.