-
Notifications
You must be signed in to change notification settings - Fork 114
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
QuestsFix v4 - fallback lang to en when lang isnt in masterfile for Questtask #863
Conversation
Good idea, but wouldn't this be better just to fall back to 'en' inside getQuest? It knows immediately if the language entry cannot be retrieved and could just retrieve the english one |
the way it is now? for german translation it works but i have no chance to test it like above for users with language not in masterfile |
src/controllers/quest.js
Outdated
@@ -387,6 +387,10 @@ class Quest extends Controller { | |||
if (item.quest_task && !this.config.general.ignoreMADQuestString) { | |||
str = item.quest_task | |||
} else { | |||
if (!Object.keys(this.GameData.translations).includes(language)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could just do !this.GameData.translations[language]
?
since that would return undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this:
if (!Object.keys(this.GameData.translations).includes(language)) {
this.log.warn(`Missing language ${language}, fallback to english`)
language = 'en'
}
to:
language = !this.GameData.translations[language] ? 'en' : language
and no log entry, that it fallback ???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a log entry is probably not required so this would work well.
some people don't like ?: as it doesn't scan as well visually; I have no problem with it
beautiful, if you confirm working will merge |
for german translation (no fallback) it works, but actually i have no possibility to test with fallback |
if user use language in poracle for dts, which isnt in masterfile, the questtask gen. fails - so:
check masterfile for available language and if it dosnt match to user language -> fallback to english
tested by dkmur in his multilang poracle