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

raidboss: localized job names #5930

Merged
merged 7 commits into from
Nov 15, 2023
Merged

raidboss: localized job names #5930

merged 7 commits into from
Nov 15, 2023

Conversation

Souma-Sumire
Copy link
Contributor

Please provide any comments.

resources/party.ts Outdated Show resolved Hide resolved
resources/party.ts Outdated Show resolved Hide resolved
import { OutputStringsParamObject } from './trigger';

export type BasePartyMemberParamObject = {
role?: Role;
role?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change the type of the Role? I think you should keep it remained but add none into Role 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 'role' is not a fixed string after localization.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm, in this case, I would recommend to add an extra field to store the localized name rather than changing the original one. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with your idea. Initially, I also added a new attribute.

However, later I thought that existing users might have saved options with 'role' as the key.

For instance, if I added a new one, let's say 'roleName,' how should we handle users who previously saved options with 'role'?

Do we need to delete the 'role' option, and if not deleted, this option would only be effective for English language users, while 'roleName' would only be effective for non-English users. This would be quite awkward.

I haven't come up with a good solution.

Copy link
Owner

Choose a reason for hiding this comment

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

I think this has only been out briefly, so I think it's fine to change and not worry about existing users.

Do we need to delete the 'role' option, and if not deleted, this option would only be effective for English language users, while 'roleName' would only be effective for non-English users. This would be quite awkward.

Yeah, this is my worry as well. I think I would prefer to have role localized and not need two of them. I don't think that non-English users need to be able to access the English role name. (It's sort of the same thing with job and jobAbbr too.)

ui/raidboss/raidboss_config.ts Outdated Show resolved Hide resolved
Copy link
Owner

@quisquous quisquous left a comment

Choose a reason for hiding this comment

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

Thank you!!!

resources/party.ts Outdated Show resolved Hide resolved
types/party.d.ts Outdated Show resolved Hide resolved
resources/party.ts Outdated Show resolved Hide resolved
resources/party.ts Outdated Show resolved Hide resolved
Comment on lines 284 to 287
const jobAbbr = jobLocalizedAbbr[job]?.[Options.AlertsLanguage ?? 'en'] ?? job;
const jobFull = jobLocalizedFull[job]?.[Options.AlertsLanguage ?? 'en'] ?? job;
const role = Util.jobToRole(job);
const roleName = roleLocalized[role]?.[Options.AlertsLanguage ?? 'en'] ?? role;
Copy link
Owner

@quisquous quisquous Nov 15, 2023

Choose a reason for hiding this comment

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

Suggested change
const jobAbbr = jobLocalizedAbbr[job]?.[Options.AlertsLanguage ?? 'en'] ?? job;
const jobFull = jobLocalizedFull[job]?.[Options.AlertsLanguage ?? 'en'] ?? job;
const role = Util.jobToRole(job);
const roleName = roleLocalized[role]?.[Options.AlertsLanguage ?? 'en'] ?? role;
const lang = this.options.DisplayLanguage;
const jobAbbr = jobLocalizedAbbr[job]?.[lang] ?? job;
const jobFull = jobLocalizedFull[job]?.[lang] ?? job;
const role = Util.jobToRole(job);
const roleName = roleLocalized[role]?.[lang] ?? role;

The Options object is the default and not (necessarily?) the one with user config applied. It's better to use the one passed into the constructor here. I think DisplayLanguage is more correct here as this.options doesn't know about AlertsLanguage for oopsy. I think you'll need to add it (or both) to the PartyTrackerOptions type.

Copy link
Owner

Choose a reason for hiding this comment

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

(sorry for the complication, I forgot this part)

resources/party.ts Outdated Show resolved Hide resolved
@@ -17,7 +18,7 @@ export interface PartyMemberParamObject
}

// This is a partial interface of both RaidbossOptions and OopsyOptions.
export interface PartyTrackerOptions {
export interface PartyTrackerOptions extends BaseOptions {
Copy link
Owner

Choose a reason for hiding this comment

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

Ah this is a good idea, thanks!

@quisquous quisquous merged commit d5c1b46 into quisquous:main Nov 15, 2023
6 checks passed
github-actions bot pushed a commit to NewMoe-Technology/cactbot-quisquous that referenced this pull request Nov 15, 2023
@Souma-Sumire Souma-Sumire deleted the Localized-Job-Names branch November 15, 2023 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants