Skip to content

Commit 82491b0

Browse files
committed
add translations
1 parent 54afeff commit 82491b0

File tree

9 files changed

+131
-47
lines changed

9 files changed

+131
-47
lines changed

public/locales/en.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,8 @@
446446
"orgSettings": {
447447
"title": "Talawa Setting",
448448
"pageName": "Settings",
449+
"generalSettings": "General",
450+
"actionItemCategorySettings": "Action Item Categories",
449451
"updateOrganization": "Update Organization",
450452
"seeRequest": "See Request",
451453
"settings": "Settings",
@@ -742,10 +744,18 @@
742744
"fieldRemovalSuccess": "Field removed successfully"
743745
},
744746
"orgActionItemCategories": {
745-
"addActionItemCategory": "Create",
747+
"createButton": "Create",
748+
"editButton": "Edit",
749+
"enableButton": "Enable",
750+
"disableButton": "Disable",
746751
"updateActionItemCategory": "Update",
747752
"actionItemCategoryName": "Name",
748753
"actionItemCategoryDetails": "Action Item Category Details",
749-
"enterName": "Enter Name"
754+
"enterName": "Enter Name",
755+
"successfulCreation": "Action Item Category created successfully",
756+
"successfulUpdation": "Action Item Category updated successfully",
757+
"sameNameConflict": "Please change the name to make an update",
758+
"categoryEnabled": "Action Item Category Enabled",
759+
"categoryDisabled": "Action Item Category Disabled"
750760
}
751761
}

public/locales/fr.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@
441441
"orgSettings": {
442442
"title": "Paramètre Talawa",
443443
"pageName": "Paramètres",
444+
"generalSettings": "Général",
445+
"actionItemCategorySettings": "Catégories d’éléments d’action",
444446
"updateYourDetails": "Mettre à jour vos informations",
445447
"updateYourPassword": "Mettez à jour votre mot de passe",
446448
"updateOrganization": "Mettre à jour l'organisation",
@@ -449,7 +451,8 @@
449451
"noData": "Pas de données",
450452
"otherSettings": "Autres paramètres",
451453
"changeLanguage": "Changer la langue",
452-
"manageCustomFields": "Gérer les Champs Personnalisés"
454+
"manageCustomFields": "Gérer les Champs Personnalisés",
455+
"actionItemCategories": "Catégories d’éléments d’action"
453456
},
454457
"deleteOrg": {
455458
"deleteOrganization": "Supprimer l'organisation",
@@ -724,5 +727,20 @@
724727
"Supprimer le champ personnalisé": "Supprimer le champ personnalisé",
725728
"fieldSuccessMessage": "Champ ajouté avec succès",
726729
"fieldRemovalSuccess": "Champ supprimé avec succès"
730+
},
731+
"orgActionItemCategories": {
732+
"createButton": "Créez",
733+
"editButton": "Éditez",
734+
"enableButton": "Activez",
735+
"disableButton": "Désactivez",
736+
"updateActionItemCategory": "Mettre à jour",
737+
"actionItemCategoryName": "Nom",
738+
"actionItemCategoryDetails": "Détails de la catégorie d’élément d’action",
739+
"enterName": "Entrez le nom",
740+
"successfulCreation": "Catégorie d’élément d’action créée avec succès",
741+
"successfulUpdation": "La catégorie d’élément d’action a été mise à jour avec succès",
742+
"sameNameConflict": "Veuillez modifier le nom pour effectuer une mise à jour",
743+
"categoryEnabled": "Catégorie d’action activée",
744+
"categoryDisabled": "Catégorie d’action désactivée"
727745
}
728746
}

public/locales/hi.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@
441441
"orgSettings": {
442442
"title": "तलावा सेटिंग",
443443
"pageName": "सेटिंग्स",
444+
"generalSettings": "सामान्य",
445+
"actionItemCategorySettings": "कार्रवाई आइटम श्रेणियाँ",
444446
"updateYourDetails": "अपना विवरण अपडेट करें",
445447
"updateYourPassword": "अपना पासवर्ड अपडेट करें",
446448
"updateOrganization": "अद्यतन संगठन",
@@ -449,7 +451,8 @@
449451
"noData": "कोई डेटा नहीं",
450452
"otherSettings": "अन्य सेटिंग्स",
451453
"changeLanguage": "भाषा बदलें",
452-
"manageCustomFields": "कस्टम फ़ील्ड प्रबंधन करें"
454+
"manageCustomFields": "कस्टम फ़ील्ड प्रबंधन करें",
455+
"actionItemCategories": "कार्रवाई आइटम श्रेणियाँ"
453456
},
454457
"deleteOrg": {
455458
"deleteOrganization": "संगठन हटाएं",
@@ -725,5 +728,20 @@
725728
"Remove Custom Field": "कस्टम फ़ील्ड हटाएँ",
726729
"fieldSuccessMessage": "फ़ील्ड सफलतापूर्वक जोड़ा गया",
727730
"fieldRemovalSuccess": "फ़ील्ड सफलतापूर्वक हटा दिया गया"
731+
},
732+
"orgActionItemCategories": {
733+
"createButton": "बनाएं",
734+
"editButton": "संपादित करें",
735+
"enableButton": "सक्षम करें",
736+
"disableButton": "अक्षम करें",
737+
"updateActionItemCategory": "अद्यतन करें",
738+
"actionItemCategoryName": "नाम",
739+
"actionItemCategoryDetails": "कार्रवाई आइटम श्रेणी विवरण",
740+
"enterName": "नाम दर्ज करें",
741+
"successfulCreation": "कार्रवाई आइटम श्रेणी सफलतापूर्वक बनाई गई",
742+
"successfulUpdation": "क्रिया आइटम श्रेणी सफलतापूर्वक अद्यतन की गई",
743+
"sameNameConflict": "अपडेट करने के लिए कृपया नाम बदलें",
744+
"categoryEnabled": "कार्रवाई आइटम श्रेणी सक्षम",
745+
"categoryDisabled": "क्रिया आइटम श्रेणी अक्षम की गई"
728746
}
729747
}

public/locales/sp.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,8 @@
440440
"orgSettings": {
441441
"title": "Configuración Talawa",
442442
"pageName": "Configuración",
443+
"generalSettings": "General",
444+
"actionItemCategorySettings": "Categorías de elementos de acción",
443445
"updateYourDetails": "Actualiza tus datos",
444446
"updateYourPassword": "Actualice su contraseña",
445447
"updateOrganization": "Actualizar Organización",
@@ -448,7 +450,8 @@
448450
"noData": "Sin datos",
449451
"otherSettings": "Otras Configuraciones",
450452
"changeLanguage": "Cambiar Idioma",
451-
"manageCustomFields": "Gestionar Campos Personalizados"
453+
"manageCustomFields": "Gestionar Campos Personalizados",
454+
"actionItemCategories": "Categorías de elementos de acción"
452455
},
453456
"deleteOrg": {
454457
"deleteOrganization": "Eliminar organización",
@@ -724,5 +727,20 @@
724727
"Remove Custom Field": "Eliminar Campo Personalizado",
725728
"fieldSuccessMessage": "Campo añadido exitosamente",
726729
"fieldRemovalSuccess": "Campo eliminado exitosamente"
730+
},
731+
"orgActionItemCategories": {
732+
"createButton": "Crear",
733+
"editButton": "Editar",
734+
"enableButton": "Habilitar",
735+
"disableButton": "Inhabilitar",
736+
"updateActionItemCategory": "Actualizar",
737+
"actionItemCategoryName": "Nombre",
738+
"actionItemCategoryDetails": "Detalles de la categoría de elemento de acción",
739+
"enterName": "Introduzca el nombre",
740+
"successfulCreation": "Categoría de elemento de acción creada correctamente",
741+
"successfulUpdation": "Categoría de elemento de acción actualizada correctamente",
742+
"sameNameConflict": "Cambie el nombre para realizar una actualización",
743+
"categoryEnabled": "Categoría de elemento de acción habilitada",
744+
"categoryDisabled": "Categoría de elemento de acción deshabilitada"
727745
}
728746
}

public/locales/zh.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@
441441
"orgSettings": {
442442
"title": "塔拉瓦設置",
443443
"pageName": "设置",
444+
"generalSettings": "一般",
445+
"actionItemCategorySettings": "措施项类别",
444446
"updateYourDetails": "更新您的詳細信息",
445447
"updateYourPassword": "更新您的密碼",
446448
"updateOrganization": "更新組織",
@@ -449,7 +451,8 @@
449451
"noData": "沒有數據",
450452
"otherSettings": "其他设置",
451453
"changeLanguage": "更改语言",
452-
"manageCustomFields": "管理自定义字段"
454+
"manageCustomFields": "管理自定义字段",
455+
"actionItemCategories": "措施项类别"
453456
},
454457
"deleteOrg": {
455458
"deleteOrganization": "删除组织",
@@ -725,5 +728,20 @@
725728
"删除自定义字段": "删除自定义字段",
726729
"fieldSuccessMessage": "字段添加成功",
727730
"fieldRemovalSuccess": "字段删除成功"
731+
},
732+
"orgActionItemCategories": {
733+
"createButton": "创建",
734+
"editButton": "编辑",
735+
"enableButton": "启用",
736+
"disableButton": "禁用",
737+
"updateActionItemCategory": "更新",
738+
"actionItemCategoryName": "名称",
739+
"actionItemCategoryDetails": "措施项类别详细信息",
740+
"enterName": "输入名称",
741+
"successfulCreation": "已成功创建措施项类别",
742+
"successfulUpdation": "措施项类别已成功更新",
743+
"sameNameConflict": "请更改名称以进行更新",
744+
"categoryEnabled": "已启用措施项类别",
745+
"categoryDisabled": "措施项类别已禁用"
728746
}
729747
}

src/GraphQl/Mutations/ActionItemCategoryMutations.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ export const CREATE_ACTION_ITEM_CATEGORY_MUTATION = gql`
1111
mutation CreateActionItemCategory($name: String!, $organizationId: ID!) {
1212
createActionItemCategory(name: $name, organizationId: $organizationId) {
1313
_id
14-
name
15-
organization {
16-
_id
17-
}
18-
isDisabled
1914
}
2015
}
2116
`;
@@ -39,11 +34,6 @@ export const UPDATE_ACTION_ITEM_CATEGORY_MUTATION = gql`
3934
data: { name: $name, isDisabled: $isDisabled }
4035
) {
4136
_id
42-
name
43-
organization {
44-
_id
45-
}
46-
isDisabled
4737
}
4838
}
4939
`;

src/components/OrgActionItemCategories/OrgActionItemCategories.module.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
}
1919

2020
.message {
21-
height: 420px;
2221
display: flex;
2322
justify-content: center;
2423
align-items: center;

src/components/OrgActionItemCategories/OrgActionItemCategories.tsx

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import React, { useState } from 'react';
33
import { Button, Form, Modal } from 'react-bootstrap';
44
import styles from './OrgActionItemCategories.module.css';
55
import { useTranslation } from 'react-i18next';
6+
import { toast } from 'react-toastify';
7+
import { WarningAmberRounded } from '@mui/icons-material';
68

79
import { useMutation, useQuery } from '@apollo/client';
810
import {
911
CREATE_ACTION_ITEM_CATEGORY_MUTATION,
1012
UPDATE_ACTION_ITEM_CATEGORY_MUTATION,
1113
} from 'GraphQl/Mutations/mutations';
12-
import { toast } from 'react-toastify';
13-
import type { InterfaceActionItemCategoryList } from 'utils/interfaces';
1414
import { ACTION_ITEM_CATEGORY_LIST } from 'GraphQl/Queries/ActionItemCategoryQueries';
15+
import type { InterfaceActionItemCategoryList } from 'utils/interfaces';
1516
import Loader from 'components/Loader/Loader';
16-
import { WarningAmberRounded } from '@mui/icons-material';
1717

1818
type ModalType = 'Create' | 'Update';
1919

@@ -27,6 +27,7 @@ const OrgActionItemCategories = (): any => {
2727
const [categoryId, setCategoryId] = useState('');
2828

2929
const [name, setName] = useState('');
30+
const [currName, setCurrName] = useState('');
3031

3132
const currentUrl = window.location.href.split('=')[1];
3233

@@ -60,7 +61,7 @@ const OrgActionItemCategories = (): any => {
6061
): Promise<void> => {
6162
e.preventDefault();
6263
try {
63-
const { data } = await createActionItemCategory({
64+
await createActionItemCategory({
6465
variables: {
6566
name,
6667
organizationId: currentUrl,
@@ -72,8 +73,7 @@ const OrgActionItemCategories = (): any => {
7273

7374
setAddModalIsOpen(false);
7475

75-
toast.success('Action Item Category created successfully');
76-
console.log(data);
76+
toast.success(t('successfulCreation'));
7777
} catch (error: any) {
7878
toast.error(error.message);
7979
console.log(error);
@@ -82,24 +82,28 @@ const OrgActionItemCategories = (): any => {
8282

8383
const handleEdit = async (e: ChangeEvent<HTMLFormElement>): Promise<void> => {
8484
e.preventDefault();
85-
try {
86-
await updateActionItemCategory({
87-
variables: {
88-
actionItemCategoryId: categoryId,
89-
name,
90-
},
91-
});
85+
if (name === currName) {
86+
toast.info(t('sameNameConflict'));
87+
} else {
88+
try {
89+
await updateActionItemCategory({
90+
variables: {
91+
actionItemCategoryId: categoryId,
92+
name,
93+
},
94+
});
9295

93-
setName('');
94-
setCategoryId('');
95-
refetch();
96+
setName('');
97+
setCategoryId('');
98+
refetch();
9699

97-
setAddModalIsOpen(false);
100+
setAddModalIsOpen(false);
98101

99-
toast.success('Action Item Category updated successfully');
100-
} catch (error: any) {
101-
toast.error(error.message);
102-
console.log(error);
102+
toast.success(t('successfulUpdation'));
103+
} catch (error: any) {
104+
toast.error(error.message);
105+
console.log(error);
106+
}
103107
}
104108
};
105109

@@ -118,9 +122,7 @@ const OrgActionItemCategories = (): any => {
118122
refetch();
119123

120124
toast.success(
121-
`Action Item Category ${
122-
disabledStatus === true ? 'Enabled' : 'Disabled'
123-
}`
125+
disabledStatus ? t('categoryEnabled') : t('categoryDisabled')
124126
);
125127
} catch (error: any) {
126128
toast.error(error.message);
@@ -134,6 +136,7 @@ const OrgActionItemCategories = (): any => {
134136
};
135137

136138
const showUpdateModal = (name: string, id: string): void => {
139+
setCurrName(name);
137140
setName(name);
138141
setCategoryId(id);
139142
setModalType('Update');
@@ -173,23 +176,31 @@ const OrgActionItemCategories = (): any => {
173176
data-testid="saveChangesBtn"
174177
>
175178
<i className={'fa fa-plus me-2'} />
176-
{t('addActionItemCategory')}
179+
{t('createButton')}
177180
</Button>
178181

179182
<div>
180183
{data?.actionItemCategoriesByOrganization.map((category, index) => {
181184
return (
182185
<div key={index}>
183186
<div className="my-3 d-flex justify-content-between align-items-center">
184-
<h6 className="fw-bold mb-0">{category.name}</h6>
187+
<h6
188+
className={
189+
category.isDisabled
190+
? 'text-secondary fw-bold mb-0'
191+
: 'fw-bold mb-0'
192+
}
193+
>
194+
{category.name}
195+
</h6>
185196
<div>
186197
<Button
187198
onClick={() => showUpdateModal(category.name, category._id)}
188199
size="sm"
189200
variant="secondary"
190201
className="me-2"
191202
>
192-
Edit
203+
{t('editButton')}
193204
</Button>
194205
<Button
195206
onClick={() =>
@@ -198,7 +209,9 @@ const OrgActionItemCategories = (): any => {
198209
size="sm"
199210
variant={category.isDisabled ? 'outline-success' : 'danger'}
200211
>
201-
{category.isDisabled ? 'Enable' : 'Disable'}
212+
{category.isDisabled
213+
? t('enableButton')
214+
: t('disableButton')}
202215
</Button>
203216
</div>
204217
</div>

src/screens/OrgSettings/OrgSettings.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function orgSettings(): JSX.Element {
3838
}
3939
onClick={() => setSetting('General')}
4040
>
41-
General
41+
{t('generalSettings')}
4242
</Button>
4343
<Button
4444
className="border rounded-3"
@@ -49,7 +49,7 @@ function orgSettings(): JSX.Element {
4949
}
5050
onClick={() => setSetting('ActionItemCategories')}
5151
>
52-
Action Item Categories
52+
{t('actionItemCategorySettings')}
5353
</Button>
5454
</Col>
5555

0 commit comments

Comments
 (0)