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 { LocalDate } from 'js-joda'
|
||||
import useComponentTranslation from '../hooks/useComponentTranslation'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
const Home = ({ navigate, setDate }) => {
|
||||
|
||||
const { t } = useComponentTranslation('components.Home')
|
||||
const { t } = useTranslation()
|
||||
|
||||
function navigateToCycleDayView() {
|
||||
setDate(todayDateString)
|
||||
@@ -46,7 +46,7 @@ const Home = ({ navigate, setDate }) => {
|
||||
{cycleDayNumber &&
|
||||
<View style={styles.line}>
|
||||
<AppText style={styles.whiteSubtitle}>{cycleDayText}</AppText>
|
||||
<AppText style={styles.turquoiseText}>{t('cycleDay')}</AppText>
|
||||
<AppText style={styles.turquoiseText}>{t('labels.home.cycleDay')}</AppText>
|
||||
</View>
|
||||
}
|
||||
{phase &&
|
||||
@@ -55,7 +55,7 @@ const Home = ({ navigate, setDate }) => {
|
||||
{formatWithOrdinalSuffix(phase)}
|
||||
</AppText>
|
||||
<AppText style={styles.turquoiseText}>
|
||||
{t('cyclePhase')}
|
||||
{t('labels.home.cyclePhase')}
|
||||
</AppText>
|
||||
<AppText style={styles.turquoiseText}>{status}</AppText>
|
||||
<Asterisk />
|
||||
@@ -65,7 +65,7 @@ const Home = ({ navigate, setDate }) => {
|
||||
<AppText style={styles.turquoiseText}>{prediction}</AppText>
|
||||
</View>
|
||||
<Button isCTA isSmall={false} onPress={navigateToCycleDayView}>
|
||||
{t('addDataForToday')}
|
||||
{t('labels.home.addDataForToday')}
|
||||
</Button>
|
||||
{phase && (
|
||||
<View style={styles.asteriskLine}>
|
||||
|
||||
@@ -18,7 +18,7 @@ function getTimes(prediction) {
|
||||
}
|
||||
|
||||
export function determinePredictionText(bleedingPrediction, t) {
|
||||
if (!bleedingPrediction.length) return t('noPrediction')
|
||||
if (!bleedingPrediction.length) return t('labels.bleedingPrediction.noPrediction')
|
||||
const {
|
||||
todayDate,
|
||||
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 };
|
||||
}
|
||||
+7
-5
@@ -1,10 +1,12 @@
|
||||
{
|
||||
"components": {
|
||||
"Home": {
|
||||
"addDataForToday": "add data for today",
|
||||
"noPrediction": "As soon as you have tracked 3 menstrual cycles, drip will make predictions for the next ones.",
|
||||
"labels": {
|
||||
"home": {
|
||||
"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