Skip to content
Snippets Groups Projects
Commit b9398324 authored by Lisa's avatar Lisa
Browse files

Merge branch '511-use-translation-library-for-license-component' into 'master'

Use translation library for license component

Closes #511

See merge request bloodyhealth/drip!373
parents f462b349 009b6b38
No related branches found
No related tags found
No related merge requests found
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { BackHandler, StyleSheet, View } from 'react-native' import { BackHandler, StyleSheet, View } from 'react-native'
import { useTranslation } from 'react-i18next'
import AppPage from './common/app-page' import AppPage from './common/app-page'
import AppText from './common/app-text' import AppText from './common/app-text'
...@@ -9,28 +10,27 @@ import Segment from './common/segment' ...@@ -9,28 +10,27 @@ import Segment from './common/segment'
import { saveLicenseFlag } from '../local-storage' import { saveLicenseFlag } from '../local-storage'
import { shared } from '../i18n/en/labels'
import settingsLabels from '../i18n/en/settings'
import { Containers } from '../styles' import { Containers } from '../styles'
const labels = settingsLabels.license
export default function License({ setLicense }) { export default function License({ setLicense }) {
const onAcceptLicense = async () => { const onAcceptLicense = async () => {
await saveLicenseFlag() await saveLicenseFlag()
setLicense() setLicense()
} }
const { t } = useTranslation()
const currentYear = new Date().getFullYear()
return ( return (
<AppPage testID="licensePage"> <AppPage testID="licensePage">
<Segment last testID="test" title={labels.title}> <Segment last testID="test" title={t("settings.license.title")}>
<AppText testID="test">{labels.text}</AppText> <AppText testID="test">{t("settings.license.text", { currentYear })}</AppText>
<View style={styles.container}> <View style={styles.container}>
<Button onPress={BackHandler.exitApp} testID="licenseCancelButton"> <Button onPress={BackHandler.exitApp} testID="licenseCancelButton">
{shared.cancel} {t("labels.shared.cancel")}
</Button> </Button>
<Button isCTA onPress={onAcceptLicense} testID="licenseOkButton"> <Button isCTA onPress={onAcceptLicense} testID="licenseOkButton">
{shared.ok} {t("labels.shared.ok")}
</Button> </Button>
</View> </View>
</Segment> </Segment>
......
...@@ -9,7 +9,7 @@ import { openDb } from '../db' ...@@ -9,7 +9,7 @@ import { openDb } from '../db'
import App from './app' import App from './app'
import AppLoadingView from './common/app-loading' import AppLoadingView from './common/app-loading'
import AppStatusBar from './common/app-status-bar' import AppStatusBar from './common/app-status-bar'
import License from './license' import License from './License'
import PasswordPrompt from './password-prompt' import PasswordPrompt from './password-prompt'
import store from "../store" import store from "../store"
......
import React from 'react' import React from 'react'
import { useTranslation } from 'react-i18next'
import AppPage from '../common/app-page' import AppPage from '../common/app-page'
import AppText from '../common/app-text' import AppText from '../common/app-text'
import Segment from '../common/segment' import Segment from '../common/segment'
import labels from '../../i18n/en/settings'
const License = () => { const License = () => {
const { t } = useTranslation()
const currentYear = new Date().getFullYear()
return ( return (
<AppPage title={labels.license.title}> <AppPage title={t("settings.license.title")}>
<Segment last> <Segment last>
<AppText>{labels.license.text}</AppText> <AppText>{t("settings.license.text", { currentYear })}</AppText>
</Segment> </Segment>
</AppPage> </AppPage>
) )
......
{ {
"labels": { "labels": {
"bleedingPrediction": {
"noPrediction": "As soon as you have tracked 3 menstrual cycles, drip will make predictions for the next ones."
},
"home": { "home": {
"cycleDay": " day of your cycle", "cycleDay": " day of your cycle",
"cyclePhase": " cycle phase - ", "cyclePhase": " cycle phase - ",
"addDataForToday": "add data for today" "addDataForToday": "add data for today"
}, },
"bleedingPrediction": { "shared": {
"noPrediction": "As soon as you have tracked 3 menstrual cycles, drip will make predictions for the next ones." "cancel": "Cancel",
"ok": "OK"
}
},
"settings": {
"license": {
"title": "drip is an open-source cycle tracking app",
"text": "Copyright (C) {{currentYear}} Bloody Health GbR\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details: https://www.gnu.org/licenses/gpl-3.0.html\n\nYou can contact us by drip@mailbox.org."
} }
} }
} }
\ No newline at end of file
import links from './links' import links from './links'
const currentYear = new Date().getFullYear()
export default { export default {
title: 'Settings', title: 'Settings',
menuItems: { menuItems: {
...@@ -118,14 +116,6 @@ export default { ...@@ -118,14 +116,6 @@ export default {
title: 'Remember to think for yourself', title: 'Remember to think for yourself',
text: `drip makes period predictions for you and helps you apply NFP fertility awareness rules. But please remember that this app is made by humans, and humans make mistakes. Always think for yourself: "Does this make sense?" Remember, you don't need an app to understand your cycle! However, drip wants to support you and make period tracking easier, more transparent and secure.`, text: `drip makes period predictions for you and helps you apply NFP fertility awareness rules. But please remember that this app is made by humans, and humans make mistakes. Always think for yourself: "Does this make sense?" Remember, you don't need an app to understand your cycle! However, drip wants to support you and make period tracking easier, more transparent and secure.`,
}, },
license: {
title: 'drip is an open-source cycle tracking app',
text: `Copyright (C) ${currentYear} Bloody Health GbR
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details: https://www.gnu.org/licenses/gpl-3.0.html
You can contact us by bloodyhealth@mailbox.org.`
},
version: { version: {
title: 'Version' title: 'Version'
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment