mirror of
https://git.sr.ht/~ashkeel/strimertul
synced 2024-09-20 02:00:49 +00:00
refactor: make APPNAME a locale global
This commit is contained in:
parent
0e363ff829
commit
fef4aebcb7
5 changed files with 10 additions and 11 deletions
|
@ -1,5 +1,6 @@
|
||||||
import i18n from 'i18next';
|
import i18n from 'i18next';
|
||||||
import { initReactI18next } from 'react-i18next';
|
import { initReactI18next } from 'react-i18next';
|
||||||
|
import { APPNAME } from '../ui/theme';
|
||||||
|
|
||||||
import en from './en/translation.json';
|
import en from './en/translation.json';
|
||||||
import it from './it/translation.json';
|
import it from './it/translation.json';
|
||||||
|
@ -17,5 +18,8 @@ void i18n.use(initReactI18next).init({
|
||||||
fallbackLng: 'en',
|
fallbackLng: 'en',
|
||||||
interpolation: {
|
interpolation: {
|
||||||
escapeValue: false,
|
escapeValue: false,
|
||||||
|
defaultVariables: {
|
||||||
|
APPNAME,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,7 +38,7 @@ import LoyaltyRewardsPage from './pages/LoyaltyRewards';
|
||||||
import ServerSettingsPage from './pages/ServerSettings';
|
import ServerSettingsPage from './pages/ServerSettings';
|
||||||
import StrimertulPage from './pages/Strimertul';
|
import StrimertulPage from './pages/Strimertul';
|
||||||
import TwitchSettingsPage from './pages/TwitchSettings';
|
import TwitchSettingsPage from './pages/TwitchSettings';
|
||||||
import { APPNAME, styled } from './theme';
|
import { styled } from './theme';
|
||||||
|
|
||||||
// @ts-expect-error Asset import
|
// @ts-expect-error Asset import
|
||||||
import spinner from '../assets/icon-loading.svg';
|
import spinner from '../assets/icon-loading.svg';
|
||||||
|
@ -210,7 +210,7 @@ export default function App(): JSX.Element {
|
||||||
}, [ready, connected]);
|
}, [ready, connected]);
|
||||||
|
|
||||||
if (connected === ConnectionStatus.NotConnected) {
|
if (connected === ConnectionStatus.NotConnected) {
|
||||||
return <Loading message={t('special.loading', { APPNAME })} />;
|
return <Loading message={t('special.loading')} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connected === ConnectionStatus.AuthenticationNeeded) {
|
if (connected === ConnectionStatus.AuthenticationNeeded) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { styled } from '@stitches/react';
|
import { styled } from '@stitches/react';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { APPNAME, Button, InputBox, TextBlock } from '../theme';
|
import { Button, InputBox, TextBlock } from '../theme';
|
||||||
|
|
||||||
const AuthWrapper = styled('div', {
|
const AuthWrapper = styled('div', {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
|
@ -59,9 +59,7 @@ export default function AuthDialog(): React.ReactElement {
|
||||||
>
|
>
|
||||||
<AuthTitle>{t('pages.auth.title')}</AuthTitle>
|
<AuthTitle>{t('pages.auth.title')}</AuthTitle>
|
||||||
<Content>
|
<Content>
|
||||||
<TextBlock spacing="none">
|
<TextBlock spacing="none">{t('pages.auth.desc')}</TextBlock>
|
||||||
{t('pages.auth.desc', { APPNAME })}
|
|
||||||
</TextBlock>
|
|
||||||
<TextBlock spacing="none">{t('pages.auth.no-pwd-note')}</TextBlock>
|
<TextBlock spacing="none">{t('pages.auth.no-pwd-note')}</TextBlock>
|
||||||
</Content>
|
</Content>
|
||||||
<Actions>
|
<Actions>
|
||||||
|
|
|
@ -115,7 +115,7 @@ export default function StrimertulPage(): React.ReactElement {
|
||||||
<Section>
|
<Section>
|
||||||
<SectionHeader>{t('pages.strimertul.need-help')}</SectionHeader>
|
<SectionHeader>{t('pages.strimertul.need-help')}</SectionHeader>
|
||||||
<SectionParagraph css={{ paddingBottom: 0 }}>
|
<SectionParagraph css={{ paddingBottom: 0 }}>
|
||||||
{t('pages.strimertul.need-help-p1', { APPNAME })}
|
{t('pages.strimertul.need-help-p1')}
|
||||||
</SectionParagraph>
|
</SectionParagraph>
|
||||||
<ChannelList>
|
<ChannelList>
|
||||||
<Channel>
|
<Channel>
|
||||||
|
@ -138,7 +138,6 @@ export default function StrimertulPage(): React.ReactElement {
|
||||||
<Trans
|
<Trans
|
||||||
t={t}
|
t={t}
|
||||||
i18nKey="pages.strimertul.credits-renko"
|
i18nKey="pages.strimertul.credits-renko"
|
||||||
values={{ APPNAME }}
|
|
||||||
components={{
|
components={{
|
||||||
artist: (
|
artist: (
|
||||||
<BrowserLink href="https://twitter.com/Sonic__Chan">
|
<BrowserLink href="https://twitter.com/Sonic__Chan">
|
||||||
|
@ -155,7 +154,6 @@ export default function StrimertulPage(): React.ReactElement {
|
||||||
<Trans
|
<Trans
|
||||||
t={t}
|
t={t}
|
||||||
i18nKey="pages.strimertul.license-notice-strimertul"
|
i18nKey="pages.strimertul.license-notice-strimertul"
|
||||||
values={{ APPNAME }}
|
|
||||||
components={{
|
components={{
|
||||||
license: (
|
license: (
|
||||||
<BrowserLink href="https://github.com/strimertul/strimertul/blob/master/LICENSE">
|
<BrowserLink href="https://github.com/strimertul/strimertul/blob/master/LICENSE">
|
||||||
|
|
|
@ -14,7 +14,6 @@ import DefinitionTable from '../components/DefinitionTable';
|
||||||
import RevealLink from '../components/utils/RevealLink';
|
import RevealLink from '../components/utils/RevealLink';
|
||||||
import SaveButton from '../components/utils/SaveButton';
|
import SaveButton from '../components/utils/SaveButton';
|
||||||
import {
|
import {
|
||||||
APPNAME,
|
|
||||||
Button,
|
Button,
|
||||||
ButtonGroup,
|
ButtonGroup,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
|
@ -372,7 +371,7 @@ function TwitchEventSubSettings() {
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<p>{t('pages.twitch-settings.events.auth-message', { APPNAME })}</p>
|
<p>{t('pages.twitch-settings.events.auth-message')}</p>
|
||||||
<Button
|
<Button
|
||||||
variation="primary"
|
variation="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
Loading…
Reference in a new issue