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

QuestsFix v4 - fallback lang to en when lang isnt in masterfile for Questtask #863

Merged
merged 3 commits into from
Sep 18, 2023

Conversation

ReuschelCGN
Copy link
Contributor

@ReuschelCGN ReuschelCGN commented Aug 30, 2023

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

@jfberry
Copy link
Collaborator

jfberry commented Sep 5, 2023

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

@ReuschelCGN ReuschelCGN changed the title QuestsFix v3 - fallback lang to en when lang isnt in masterfile for Questtask QuestsFix v4 - fallback lang to en when lang isnt in masterfile for Questtask Sep 13, 2023
@ReuschelCGN
Copy link
Contributor Author

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

@@ -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)) {
Copy link
Collaborator

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?

Copy link
Contributor Author

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 ???

Copy link
Collaborator

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

@jfberry
Copy link
Collaborator

jfberry commented Sep 13, 2023

beautiful, if you confirm working will merge

@ReuschelCGN
Copy link
Contributor Author

for german translation (no fallback) it works, but actually i have no possibility to test with fallback

@jfberry jfberry merged commit 429b2a2 into KartulUdus:develop Sep 18, 2023
@ReuschelCGN ReuschelCGN deleted the QuestsFix-V3 branch September 19, 2023 07:14
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