162 Update structure of english translation file
This commit is contained in:
+5
-5
@@ -16,11 +16,11 @@ import { determinePredictionText, formatWithOrdinalSuffix } from './helpers/home
|
|||||||
|
|
||||||
import { Colors, Fonts, Sizes, Spacing } from '../styles'
|
import { Colors, Fonts, Sizes, Spacing } from '../styles'
|
||||||
import { LocalDate } from 'js-joda'
|
import { LocalDate } from 'js-joda'
|
||||||
import useComponentTranslation from '../hooks/useComponentTranslation'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
const Home = ({ navigate, setDate }) => {
|
const Home = ({ navigate, setDate }) => {
|
||||||
|
|
||||||
const { t } = useComponentTranslation('components.Home')
|
const { t } = useTranslation()
|
||||||
|
|
||||||
function navigateToCycleDayView() {
|
function navigateToCycleDayView() {
|
||||||
setDate(todayDateString)
|
setDate(todayDateString)
|
||||||
@@ -46,7 +46,7 @@ const Home = ({ navigate, setDate }) => {
|
|||||||
{cycleDayNumber &&
|
{cycleDayNumber &&
|
||||||
<View style={styles.line}>
|
<View style={styles.line}>
|
||||||
<AppText style={styles.whiteSubtitle}>{cycleDayText}</AppText>
|
<AppText style={styles.whiteSubtitle}>{cycleDayText}</AppText>
|
||||||
<AppText style={styles.turquoiseText}>{t('cycleDay')}</AppText>
|
<AppText style={styles.turquoiseText}>{t('labels.home.cycleDay')}</AppText>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
{phase &&
|
{phase &&
|
||||||
@@ -55,7 +55,7 @@ const Home = ({ navigate, setDate }) => {
|
|||||||
{formatWithOrdinalSuffix(phase)}
|
{formatWithOrdinalSuffix(phase)}
|
||||||
</AppText>
|
</AppText>
|
||||||
<AppText style={styles.turquoiseText}>
|
<AppText style={styles.turquoiseText}>
|
||||||
{t('cyclePhase')}
|
{t('labels.home.cyclePhase')}
|
||||||
</AppText>
|
</AppText>
|
||||||
<AppText style={styles.turquoiseText}>{status}</AppText>
|
<AppText style={styles.turquoiseText}>{status}</AppText>
|
||||||
<Asterisk />
|
<Asterisk />
|
||||||
@@ -65,7 +65,7 @@ const Home = ({ navigate, setDate }) => {
|
|||||||
<AppText style={styles.turquoiseText}>{prediction}</AppText>
|
<AppText style={styles.turquoiseText}>{prediction}</AppText>
|
||||||
</View>
|
</View>
|
||||||
<Button isCTA isSmall={false} onPress={navigateToCycleDayView}>
|
<Button isCTA isSmall={false} onPress={navigateToCycleDayView}>
|
||||||
{t('addDataForToday')}
|
{t('labels.home.addDataForToday')}
|
||||||
</Button>
|
</Button>
|
||||||
{phase && (
|
{phase && (
|
||||||
<View style={styles.asteriskLine}>
|
<View style={styles.asteriskLine}>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function getTimes(prediction) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function determinePredictionText(bleedingPrediction, t) {
|
export function determinePredictionText(bleedingPrediction, t) {
|
||||||
if (!bleedingPrediction.length) return t('noPrediction')
|
if (!bleedingPrediction.length) return t('labels.bleedingPrediction.noPrediction')
|
||||||
const {
|
const {
|
||||||
todayDate,
|
todayDate,
|
||||||
predictedBleedingStart,
|
predictedBleedingStart,
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
import { useTranslation } from "react-i18next"
|
|
||||||
|
|
||||||
export default function useComponentTranslation(componentPath) {
|
|
||||||
const { t, i18n } = useTranslation();
|
|
||||||
function translate(code, options) {
|
|
||||||
const mergedPath = `${componentPath}.${code}`;
|
|
||||||
const translation = t(mergedPath, options);
|
|
||||||
return translation !== mergedPath ? translation : t(code, options);
|
|
||||||
}
|
|
||||||
return { t: translate, i18n };
|
|
||||||
}
|
|
||||||
+9
-7
@@ -1,10 +1,12 @@
|
|||||||
{
|
{
|
||||||
"components": {
|
"labels": {
|
||||||
"Home": {
|
"home": {
|
||||||
"addDataForToday": "add data for today",
|
|
||||||
"noPrediction": "As soon as you have tracked 3 menstrual cycles, drip will make predictions for the next ones.",
|
|
||||||
"cycleDay": " day of your cycle",
|
"cycleDay": " day of your cycle",
|
||||||
"cyclePhase": " cycle phase - "
|
"cyclePhase": " cycle phase - ",
|
||||||
|
"addDataForToday": "add data for today"
|
||||||
|
},
|
||||||
|
"bleedingPrediction": {
|
||||||
|
"noPrediction": "As soon as you have tracked 3 menstrual cycles, drip will make predictions for the next ones."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user