Create definition for Translate#372
Conversation
for "Welcome Message" in MenuTabs.tsx and "Tips for getting started" in homescreen.html.
samuelmaddock
left a comment
There was a problem hiding this comment.
This is a good start! I need to make some changes first before these contributions can be accommodated though.
| <button id="tipsbtn" class="tips-button"> | ||
| <div class="column"> | ||
| <b>📝 Tips for getting started</b> | ||
| <b>📝 {t('tipsGettingStarted1')}</b> |
There was a problem hiding this comment.
This particular file will be tricky. It didn't have translations because it's using plain HTML. Before translations can be easily supported, it will need to be converted to a React component with JSX markup.
This is possible, but I might not be able to get around to refactoring this during the week.
| theaterModeDesc: | ||
| 'Hide all non-video content on the webpage. Note that this might also hide soft subtitles.', | ||
| thirdPartyIntegrations: 'Third-party Integrations', | ||
| tipsGettingStarted1: 'Tips for getting started', |
There was a problem hiding this comment.
Two things to note here:
- Lines that were broken into several lines can be merged into one string. CSS's layout engine will handle line wrapping for us.
- It might be best for semantics to describe the locale keys without using numbers. For example:
| tipsGettingStarted1: 'Tips for getting started', | |
| tipsGettingStartedHeader: 'Tips for getting started', |
| {t('welcomeMessage5')}{' '} | ||
| <ExternalLink href="https://github.com/samuelmaddock/metastream/wiki/FAQ"> | ||
| check out the FAQ | ||
| {t('welcomeMessage6')} | ||
| </ExternalLink>{' '} | ||
| to learn how Metastream differs. | ||
| {t('welcomeMessage7')} |
There was a problem hiding this comment.
For special cases like this where the markup is mixed in with the string, I use a special React component called <Trans>. Here's an example:
metastream/packages/metastream-app/src/components/Popup.tsx
Lines 366 to 369 in 1cd9f13
And the actual translation string looks like this:
metastream/packages/metastream-app/src/locale/en-US.ts
Lines 48 to 49 in 1cd9f13
for "Welcome Message" in MenuTabs.tsx
and "Tips for getting started" in homescreen.html.