chiyadev / genshin-schedule

🕑 Genshin farming scheduler
https://genshin.chiya.dev
MIT License
72 stars 17 forks source link

Implement full i18n support #62

Closed luaneko closed 3 years ago

luaneko commented 3 years ago

Resolves #53

ysc3839 commented 3 years ago

Personally I don't think using an ID in source code to translate is good. You should consider using defaultMessage:

<FormattedMessage
  defaultMessage="Control Panel"
  description="title of control panel section"
/>

ref: https://formatjs.io/docs/getting-started/message-extraction/

luaneko commented 3 years ago

Personally I don't think using an ID in source code to translate is good. You should consider using defaultMessage

I've considered this, and I decided not to use it still.

The main problem with auto extraction is that it doesn't handle dynamic message contents. e.g.

<FormattedMessage defaultMessage={character.name} />

The extractor fails saying we need constant messages, but we need dynamic messages if we want to be able to translate database stuff like character and weapon names.

ysc3839 commented 3 years ago

You can use ID with dynamic messages. And use defaultMessage with static messages.