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

[SRO] Organize DM-l10n strings #2491

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

tiffanynwyeung
Copy link
Collaborator

@tiffanynwyeung tiffanynwyeung commented Oct 10, 2024

Describe your changes

  • Rename and expand sheetHashData to commonHashData with generalized, game-related strings
  • Remove {SPACE} artifact during DM string preprocessing for certain languages
  • Experimental: extract non-game-related, generalized UI strings for project use

Notes:

  • A lot of strings don't have a counterpart, or a perfect singular/plural pair. This project tends to prefer more specificity in a lot of labels (e.g. Unlock All Artifacts vs simply using Unlock All and implying 'All Artifacts' context from being on the Artifacts page), so if we wanted to use these strings, we'd either commit to more generalized/"vague" wording or combine translated words (sounds messy).
  • UI strings is experimental as we need some discussion on if we want to go this route and how to make the pipeline work, as mentioned previously. The file is mostly there to provide a concrete example of what the raw data COULD look like, and/or if we wanted to use it somehow?

TODO:

  • Documentation in the lib readme?
  • Regenerating new versions of the JSON files. I'd rather do that last.

Issue or discord link

Resolves #2475.

Testing/validation

Checklist before requesting a review (leave this PR as draft if any part of this list is not done.)

  • I have commented my code in hard-to understand areas.
  • I have made corresponding changes to README or wiki.
  • For front-end changes, I have updated the corresponding English translations.
  • I have run yarn run mini-ci locally to validate format and lint.
  • If I have added a new library or app, I have updated the deployment scripts to ignore changes as needed

- rename sheet to common
- expand sheet strs to cover generalized, common "game" terms
- remove `{SPACE}` when processing certain DM strings in certain languages
Experiment for extracting common non-game-specific UI strings. Would need a new pipeline if we wanted to commit to this idea.
Copy link
Contributor

github-actions bot commented Oct 10, 2024

[sr-frontend] [Thu Oct 10 21:46:15 UTC 2024] - Deployed 328093d to https://genshin-optimizer-prs.github.io/pr/2491/sr-frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Fri Oct 18 00:03:21 UTC 2024] - Deployed 07209d5 to https://genshin-optimizer-prs.github.io/pr/2491/sr-frontend (Takes 3-5 minutes after this completes to be available)


// Remove '{SPACE}' artifacts from certain strings
// Do this first to match curly brackets to prevent interfering with later str replacements
str = str.replace(/(.*?){SPACE}/g, '$1')
Copy link
Collaborator Author

@tiffanynwyeung tiffanynwyeung Oct 10, 2024

Choose a reason for hiding this comment

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

Certain strings will contain {SPACE} at the end, so this is just an exact match to strip it out. This shouldn't conflict with any of the other matching/processing we're doing.

@@ -36,40 +37,6 @@ export const HashData = {
lightCone: lightConeHashData,
lightConeNames,

sheet: sheetHashData,
Copy link
Owner

Choose a reason for hiding this comment

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

One of the reason why we have separated namespace -> separated .JSON is that translations are usually lazy loaded. when the artifact page is loaded, it doesn't need any of the character/team UI translations, and vice versa. This can impact load time of pages and elements, since most of our elements are behind loading barriers and suspenses. we can designate some of the namespace to be permanently loaded(i think "ui" is).

Copy link
Collaborator Author

@tiffanynwyeung tiffanynwyeung Oct 18, 2024

Choose a reason for hiding this comment

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

That's understandable, and in this commit I split up a lot more of the namespaces in light of this information. Though, it also means I'm not quite sure where to put some of these smaller namespaces (e.g. common, team, paths, statKey) or what the file should be (miscHashData perhaps?).

@frzyc
Copy link
Owner

frzyc commented Oct 11, 2024

Also, can you bundling in l10n for these strings #2440 (comment), I believe they can be partially retrieved from dm.

@@ -128,4 +128,4 @@ const charArray = Object.entries(avatarConfig).map(([charId, charConfig]) => {

const data = Object.fromEntries(charArray)
verifyObjKeys(data, allCharacterDataKeys)
export const charHashData = data
export const allCharHashData = data
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If there are better name/organization suggestions from what I've done in this commit (move all related files into related folders and rename the original files generating all chars/LCs/relics + their data into terms that possibly better indicate that they're for 'generating all assets for a category'), please let me know.

@frzyc
Copy link
Owner

frzyc commented Oct 18, 2024

looks mostly organized for me. for the singular/plural, I think i prefer in the way indicated by the i18next format:

"character_one": "character"
"character_other": "characters"

rather than the label.one/label.many

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.

[SRO] DM string organization for gen-files
2 participants