Skip to content

Commit

Permalink
Add countdown translations
Browse files Browse the repository at this point in the history
  • Loading branch information
huysbs committed Apr 19, 2024
1 parent 6c2fafc commit 39319ae
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/app/components/cards/CountdownSelector.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import tt from 'counterpart';

import DateTimePicker from "../elements/DateTimePicker";

Expand All @@ -9,8 +10,8 @@ const CountdownSelector = (props) => {
<>
<div className="row">
<div className="column">
<h4>Countdown Timer</h4>
<p>Display a count down timer inside your post</p>
<h4>{tt('post_advanced_settings_jsx.countdown')}</h4>
<p>{tt('post_advanced_settings_jsx.countdown_description')}</p>
</div>
</div>
<div className="row">
Expand Down
4 changes: 4 additions & 0 deletions src/app/components/cards/PostFull.scss
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,7 @@ input.share-box {
color: black;
}
}

.PostFull__countdown {
font-size: 0.85rem;
}
5 changes: 3 additions & 2 deletions src/app/components/elements/DateTimePicker.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useCallback, useState } from 'react';
import SimplePicker from 'simplepicker';
import { DateTime } from 'luxon';
import tt from 'counterpart';

import 'simplepicker/dist/simplepicker.css';

Expand All @@ -14,7 +15,7 @@ const DateTimePicker = (props) => {
const delta = coundDownDate.diffNow().as('seconds');

if (delta < 3600) {
setError('Countdown target date should be at least one hour from now');
setError(tt('post_advanced_settings_jsx.countdown_date_error'));
} else if (onChange) {
setError('');
onChange(coundDownDate);
Expand Down Expand Up @@ -43,7 +44,7 @@ const DateTimePicker = (props) => {
className="datetimepicker_value"
type="text"
name="countdown"
placeholder="Click to choose a date and time"
placeholder={tt('post_advanced_settings_jsx.countdown_placeholder')}
value={value ? value.toLocaleString(DateTime.DATETIME_SHORT) : ''}
onClick={openPicker}
readOnly
Expand Down
6 changes: 5 additions & 1 deletion src/app/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,11 @@
"max_accepted_payout": "Maximum Accepted Payout",
"max_accepted_payout_description": "HBD value of the maximum payout this post will receive.",
"unlimited": "No limit",
"custom_value": "Custom value"
"custom_value": "Custom value",
"countdown": "Post Countdown",
"countdown_description": "Display a count down timer inside your post",
"countdown_date_error": "Countdown target date should be at least one hour from now",
"countdown_placeholder": "Click to choose a date and time"
},
"postfull_jsx": {
"this_post_is_not_available_due_to_a_copyright_claim": "This post is not available due to a copyright claim.",
Expand Down

0 comments on commit 39319ae

Please sign in to comment.