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

Create definition for Translate #372

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bissy
Copy link
Contributor

@bissy bissy commented Nov 8, 2020

for "Welcome Message" in MenuTabs.tsx
and "Tips for getting started" in homescreen.html.

for "Welcome Message" in MenuTabs.tsx
and "Tips for getting started" in homescreen.html.
Copy link
Owner

@samuelmaddock samuelmaddock left a comment

Choose a reason for hiding this comment

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

This is a good start! I need to make some changes first before these contributions can be accommodated though.

@@ -86,7 +86,7 @@
<header id="tips" class="tips">
<button id="tipsbtn" class="tips-button">
<div class="column">
<b>📝 Tips for getting started</b>
<b>📝 {t('tipsGettingStarted1')}</b>
Copy link
Owner

Choose a reason for hiding this comment

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

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.

@@ -135,6 +136,12 @@ export default {
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',
Copy link
Owner

Choose a reason for hiding this comment

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

Two things to note here:

  1. Lines that were broken into several lines can be merged into one string. CSS's layout engine will handle line wrapping for us.
  2. It might be best for semantics to describe the locale keys without using numbers. For example:
Suggested change
tipsGettingStarted1: 'Tips for getting started',
tipsGettingStartedHeader: 'Tips for getting started',

Comment on lines +66 to +70
{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')}
Copy link
Owner

Choose a reason for hiding this comment

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

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:

<Trans i18nKey="embedBlocked" values={{ host: mediaHostname }}>
To enable playback with <strong>this website</strong>, Metastream must open the
website in a popup.
</Trans>

And the actual translation string looks like this:

embedBlocked:
'To enable playback with <1>{{host}}</1>, Metastream must open the website in a popup.',

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.

2 participants