Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure fallback culture is always available #135

Merged
merged 1 commit into from
Feb 13, 2019

Conversation

JustAMan
Copy link
Contributor

Fixes #134

@JustAMan JustAMan requested a review from cvium February 13, 2019 15:36
@@ -62,6 +63,11 @@ define(['connectionManager', 'userSettings', 'events'], function (connectionMana
for (var i in allTranslations) {
ensureTranslation(allTranslations[i], culture);
}
if (culture !== fallbackCulture) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not have the if inside the loop instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because speed! :) This way it only checks once instead of how many entries there is in allTranslations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt looping over all the entries twice is faster. Maybe it's faster if your locale is already en-us, but it seems like it would be worse for any other case. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it a moot point? :) This code executes once the application is loaded, and once a localization language is changed. Even if it adds like 50 extra milliseconds is it that bad? :)

For real, it's impossible to tell which one is faster without benchmarks, and I don't think we should really be concerned with performance here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't hold this up, but the double for loop still makes me cringe. 😄

@@ -62,6 +63,11 @@ define(['connectionManager', 'userSettings', 'events'], function (connectionMana
for (var i in allTranslations) {
ensureTranslation(allTranslations[i], culture);
}
if (culture !== fallbackCulture) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt looping over all the entries twice is faster. Maybe it's faster if your locale is already en-us, but it seems like it would be worse for any other case. 😉

@LeoVerto
Copy link
Contributor

I know this naming was part of the code previously but "culture" feels like the wrong term to me. Shouldn't this be something like "localization" instead?

@Bond-009 Bond-009 merged commit c6116c2 into jellyfin:release-10.2.z Feb 13, 2019
@JustAMan
Copy link
Contributor Author

@LeoVerto maybe language or dialect?

I was sticking to the style of the file to keep changes minimal as this targeted release branch.

@JustAMan JustAMan deleted the fix-fallback branch February 14, 2019 01:28
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.

6 participants