Skip to content

Commit

Permalink
add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
meetulr committed Mar 17, 2024
1 parent 3415218 commit 3e03a7c
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 22 deletions.
11 changes: 10 additions & 1 deletion public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,16 @@
"enterDescrip": "Enter Description",
"eventLocation": "Enter Location",
"eventCreated": "Congratulations! The Event is created.",
"talawaApiUnavailable": "Talawa-API service is unavailable. Is it running? Check your network connectivity too."
"talawaApiUnavailable": "Talawa-API service is unavailable. Is it running? Check your network connectivity too.",
"customRecurrence": "Custom Recurrence",
"repeatsEvery": "Repeats Every",
"repeatsOn": "Repeats On",
"ends": "Ends",
"never": "Never",
"on": "On",
"after": "After",
"occurences": "occurences",
"done": "Done"
},
"organizationActionItems": {
"actionItemCategory": "Action Item Category",
Expand Down
11 changes: 10 additions & 1 deletion public/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,16 @@
"enterDescrip": "Entrez la description",
"eventLocation": "Entrez l'emplacement",
"eventCreated": "Toutes nos félicitations! L'événement est créé.",
"talawaApiUnavailable": "Le service Talawa-API n'est pas disponible. Est-il en cours d'exécution ? Vérifiez également votre connectivité réseau."
"talawaApiUnavailable": "Le service Talawa-API n'est pas disponible. Est-il en cours d'exécution ? Vérifiez également votre connectivité réseau.",
"customRecurrence": "Récurrence personnalisée",
"repeatsEvery": "Se répète tous les",
"repeatsOn": "Se répète sur",
"ends": "Finit",
"never": "Jamais",
"on": "Sur",
"after": "Après",
"occurences": "Occurrences",
"done": "Fait"
},
"organizationActionItems": {
"actionItemCategory": "Catégorie de l'élément d'action",
Expand Down
11 changes: 10 additions & 1 deletion public/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,16 @@
"enterDescrip": "विवरण दर्ज करें",
"eventLocation": "स्थान दर्ज करें",
"eventCreated": "बधाई हो! इवेंट बनाया गया है।",
"talawaApiUnavailable": "तलवा-एपीआई सेवा उपलब्ध नहीं है। क्या यह चल रहा है? अपनी नेटवर्क कनेक्टिविटी भी जांचें।"
"talawaApiUnavailable": "तलवा-एपीआई सेवा उपलब्ध नहीं है। क्या यह चल रहा है? अपनी नेटवर्क कनेक्टिविटी भी जांचें।",
"customRecurrence": "कस्टम पुनरावृत्ति",
"repeatsEvery": "दोहराता है हर",
"repeatsOn": "को दोहराएगा",
"ends": "समाप्त होता",
"never": "कभी नहीं",
"on": "पर",
"after": "के बाद",
"occurences": "'घटित होता है",
"done": "समाज-सम्मत"
},
"organizationActionItems": {
"actionItemCategory": "कार्य आइटम श्रेणी",
Expand Down
11 changes: 10 additions & 1 deletion public/locales/sp.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,16 @@
"enterDescrip": "Introduce la descripción",
"eventLocation": "Introducir ubicación",
"eventCreated": "¡Felicidades! Se crea el Evento.",
"talawaApiUnavailable": "El servicio Talawa-API no está disponible. ¿Está funcionando? Compruebe también la conectividad de su red."
"talawaApiUnavailable": "El servicio Talawa-API no está disponible. ¿Está funcionando? Compruebe también la conectividad de su red.",
"customRecurrence": "Recurrencia personalizada",
"repeatsEvery": "Se repite cada",
"repeatsOn": "Se repite en",
"ends": "Finaliza",
"never": "Nunca",
"on": "En",
"after": "Después de",
"occurences": "ocurrencias",
"done": "Hecho"
},
"organizationActionItems": {
"actionItemCategory": "Categoría del ítem de acción",
Expand Down
11 changes: 10 additions & 1 deletion public/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,16 @@
"enterDescrip": "輸入說明",
"eventLocation": "輸入位置",
"eventCreated": "恭喜!事件已創建。",
"talawaApiUnavailable": "服務不可用。它在運行嗎?還要檢查您的網絡連接。"
"talawaApiUnavailable": "服務不可用。它在運行嗎?還要檢查您的網絡連接。",
"customRecurrence": "自定义重复",
"repeatsEvery": "重复每",
"repeatsOn": "重复于",
"ends": "结束",
"never": "永不",
"on": "",
"after": "之后",
"occurences": "次数",
"done": "完成"
},
"organizationActionItems": {
"actionItemCategory": "行动项目类别",
Expand Down
38 changes: 21 additions & 17 deletions src/screens/OrganizationEvents/customRecurrenceModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { Dayjs } from 'dayjs';
import dayjs from 'dayjs';

const daysOptions = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];
const endsOnOptions = ['Never', 'On', 'After'];
const endsOnOptions = ['never', 'on', 'after'];

interface InterfaceCustomRecurrenceModalProps {
recurrenceRuleState: InterfaceRecurrenceRule;
Expand Down Expand Up @@ -39,31 +39,31 @@ const CustomRecurrenceModal: React.FC<InterfaceCustomRecurrenceModalProps> = ({
t,
}) => {
const { frequency, weekDays } = recurrenceRuleState;
const [endsOnOption, setEndsOnOption] = useState<string>('Never');
const [endsOnOption, setEndsOnOption] = useState<string>('never');

useEffect(() => {
if (endDate) {
setEndsOnOption('On');
setEndsOnOption('on');
}
}, [endDate]);

const handleOptionChange = (e: React.ChangeEvent<HTMLInputElement>): void => {
const endsOnOption = e.target.value;
setEndsOnOption(endsOnOption);
if (endsOnOption === 'Never') {
if (endsOnOption === 'never') {
setEndDate(null);
setRecurrenceRuleState({
...recurrenceRuleState,
count: undefined,
});
}
if (endsOnOption === 'On') {
if (endsOnOption === 'on') {
setRecurrenceRuleState({
...recurrenceRuleState,
count: undefined,
});
}
if (endsOnOption === 'After') {
if (endsOnOption === 'after') {
setEndDate(null);
}
};
Expand Down Expand Up @@ -94,7 +94,7 @@ const CustomRecurrenceModal: React.FC<InterfaceCustomRecurrenceModalProps> = ({
centered
>
<Modal.Header>
<p className={styles.titlemodal}>Custom recurrence</p>
<p className={styles.titlemodal}>{t('customRecurrence')}</p>
<Button
variant="danger"
onClick={hideCustomRecurrenceModal}
Expand All @@ -105,7 +105,9 @@ const CustomRecurrenceModal: React.FC<InterfaceCustomRecurrenceModalProps> = ({
</Modal.Header>
<Modal.Body className="pb-2">
<div className="mb-4">
<span className="fw-semibold text-secondary">Repeats every</span>{' '}
<span className="fw-semibold text-secondary">
{t('repeatsEvery')}
</span>{' '}
<FormControl
type="number"
defaultValue={1}
Expand Down Expand Up @@ -168,7 +170,9 @@ const CustomRecurrenceModal: React.FC<InterfaceCustomRecurrenceModalProps> = ({

{frequency === Frequency.WEEKLY && (
<div className="mb-4">
<span className="fw-semibold text-secondary">Repeats on</span>
<span className="fw-semibold text-secondary">
{t('repeatsOn')}
</span>
<br />
<div className="mx-2 mt-3 d-flex gap-1">
{daysOptions.map((day, index) => (
Expand All @@ -185,27 +189,27 @@ const CustomRecurrenceModal: React.FC<InterfaceCustomRecurrenceModalProps> = ({
)}

<div className="mb-3">
<span className="fw-semibold text-secondary">Ends</span>
<span className="fw-semibold text-secondary">{t('ends')}</span>
<div className="ms-3 mt-3">
<Form>
{endsOnOptions.map((option, index) => (
<div key={index} className="my-0 d-flex align-items-center">
<Form.Check
type="radio"
id={`radio-${index}`}
label={option}
label={t(option)}
name="recurrenceEnd"
className="d-inline-block me-5"
value={option}
onChange={handleOptionChange}
defaultChecked={option === endsOnOption}
/>

{option === 'On' && (
{option === 'on' && (
<div className="ms-3">
<DatePicker
className={styles.recurrenceRuleDateBox}
disabled={endsOnOption !== 'On'}
disabled={endsOnOption !== 'on'}
value={dayjs(endDate ?? new Date())}
onChange={(date: Dayjs | null): void => {
if (date) {
Expand All @@ -215,7 +219,7 @@ const CustomRecurrenceModal: React.FC<InterfaceCustomRecurrenceModalProps> = ({
/>
</div>
)}
{option === 'After' && (
{option === 'after' && (
<>
<FormControl
type="number"
Expand All @@ -228,9 +232,9 @@ const CustomRecurrenceModal: React.FC<InterfaceCustomRecurrenceModalProps> = ({
})
}
className={`${styles.recurrenceRuleNumberInput} ms-1 me-2 d-inline-block py-2`}
disabled={endsOnOption !== 'After'}
disabled={endsOnOption !== 'after'}
/>{' '}
occurrences
{t('occurences')}
</>
)}
</div>
Expand All @@ -247,7 +251,7 @@ const CustomRecurrenceModal: React.FC<InterfaceCustomRecurrenceModalProps> = ({
data-testid="customRecurrenceBtn"
onClick={handleRecurrenceRuleSubmit}
>
Done
{t('done')}
</Button>
</div>
</Modal.Body>
Expand Down

0 comments on commit 3e03a7c

Please sign in to comment.