Update translations in ListingPage

This commit is contained in:
Jenni Nurmi 2018-12-07 14:31:03 +02:00
parent 512d820c38
commit 086963a497
4 changed files with 31 additions and 4 deletions

View file

@ -2,6 +2,7 @@ import React from 'react';
import { FormattedMessage } from 'react-intl';
import { ModalInMobile, Button } from '../../components';
import { BookingDatesForm } from '../../forms';
import { LINE_ITEM_NIGHT, LINE_ITEM_DAY } from '../../util/types';
import css from './ListingPage.css';
@ -29,6 +30,15 @@ const SectionBooking = props => {
} = props;
const showClosedListingHelpText = listing.id && isClosed;
const isNightly = unitType === LINE_ITEM_NIGHT;
const isDaily = unitType === LINE_ITEM_DAY;
const unitTranslationKey = isNightly
? 'ListingPage.perNight'
: isDaily
? 'ListingPage.perDay'
: 'ListingPage.perUnit';
return (
<div>
<ModalInMobile
@ -82,7 +92,7 @@ const SectionBooking = props => {
{formattedPrice}
</div>
<div className={css.perUnit}>
<FormattedMessage id="ListingPage.perUnit" />
<FormattedMessage id={unitTranslationKey} />
</div>
</div>

View file

@ -1,6 +1,8 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { InlineTextButton } from '../../components';
import { LINE_ITEM_NIGHT, LINE_ITEM_DAY } from '../../util/types';
import config from '../../config';
import css from './ListingPage.css';
@ -14,6 +16,17 @@ const SectionHeading = props => {
showContactUser,
onContactUser,
} = props;
const unitType = config.bookingUnitType;
const isNightly = unitType === LINE_ITEM_NIGHT;
const isDaily = unitType === LINE_ITEM_DAY;
const unitTranslationKey = isNightly
? 'ListingPage.perNight'
: isDaily
? 'ListingPage.perDay'
: 'ListingPage.perUnit';
return (
<div className={css.sectionHeading}>
<div className={css.desktopPriceContainer}>
@ -21,7 +34,7 @@ const SectionHeading = props => {
{formattedPrice}
</div>
<div className={css.desktopPerUnit}>
<FormattedMessage id="ListingPage.perUnit" />
<FormattedMessage id={unitTranslationKey} />
</div>
</div>
<div className={css.heading}>

View file

@ -309,7 +309,9 @@
"ListingPage.ownListing": "This is your own listing.",
"ListingPage.ownListingDraft": "This listing is a draft.",
"ListingPage.ownListingPendingApproval": "This listing is pending approval.",
"ListingPage.perUnit": "per night",
"ListingPage.perDay": "per day",
"ListingPage.perNight": "per night",
"ListingPage.perUnit": "per unit",
"ListingPage.reviewsError": "Loading reviews failed.",
"ListingPage.reviewsHeading": "Reviews ({count})",
"ListingPage.rulesTitle": "Sauna rules",

View file

@ -309,7 +309,9 @@
"ListingPage.ownListing": "Ceci est votre propre annonce.",
"ListingPage.ownListingDraft": "Cette annonce est un brouillon.",
"ListingPage.ownListingPendingApproval": "Cette annonce est en attente de validation.",
"ListingPage.perUnit": "par nuit",
"ListingPage.perDay": "per day",
"ListingPage.perNight": "par nuit",
"ListingPage.perUnit": "per unit",
"ListingPage.reviewsError": "Impossible de charger les commentaires.",
"ListingPage.reviewsHeading": "Commentaires ({count})",
"ListingPage.rulesTitle": "Règlement",