Skip to content

added localization possibilities#6

Open
LeviG3 wants to merge 2 commits intobrycebostwick:mainfrom
LeviG3:main
Open

added localization possibilities#6
LeviG3 wants to merge 2 commits intobrycebostwick:mainfrom
LeviG3:main

Conversation

@LeviG3
Copy link
Copy Markdown

@LeviG3 LeviG3 commented Feb 16, 2025

This update enables replacements for languages beyond English. I've tested it with German, but you can expand support by adding more languages to langMappings. Additionally, I included the google.de domain in manifest.json to ensure functionality on the local domain.

@Gogotron
Copy link
Copy Markdown

There might be issues with places where Gulf of Mexico is said with the "Mexico" coming before the "Gulf of" part. I assume those exist, though I don't have an example with me.
I don't know how hard it would be to take that into account.

@LeviG3
Copy link
Copy Markdown
Author

LeviG3 commented Feb 17, 2025

You´re right, I am gonna look into this and will update it accordingly. I also noticed a logic error in my code which will need to fixed.

@simeoncapy
Copy link
Copy Markdown

In French the base prefixe is also not the same between both, with "Golfe d'Amérique" and "Golfe du Mexique", due to the voyelle in Amérique.

Comment on lines +20 to +21
},
/* Add more languages here as needed */
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
},
/* Add more languages here as needed */
},
"fr": {
base: "Golfe ",
originalCountry: "d'Amérique",
replacementCountry: "du Mexique"
},
/* Add more languages here as needed */

this might work

Comment on lines +173 to +174
// \u200B is a zero-width space character. We add it to make the strings the same length
const REPLACEMENT_BYTES = [...mapping.replacementCountry + '\u200B'].map(char => char.charCodeAt(0))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This assumes that the localized replacementCountry has exactly 6 letters, which is not always the case. A .repeat() thing might work?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

i also wonder: if replacementCountry.length > originalCountry.length, will this break the parsing, since the expected protobuf response layout will change cuz alignment will be thrown off?

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.

4 participants