Skip to content

Commit

Permalink
add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
meetulr committed Jan 31, 2024
1 parent 54afeff commit 82491b0
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 47 deletions.
14 changes: 12 additions & 2 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,8 @@
"orgSettings": {
"title": "Talawa Setting",
"pageName": "Settings",
"generalSettings": "General",
"actionItemCategorySettings": "Action Item Categories",
"updateOrganization": "Update Organization",
"seeRequest": "See Request",
"settings": "Settings",
Expand Down Expand Up @@ -742,10 +744,18 @@
"fieldRemovalSuccess": "Field removed successfully"
},
"orgActionItemCategories": {
"addActionItemCategory": "Create",
"createButton": "Create",
"editButton": "Edit",
"enableButton": "Enable",
"disableButton": "Disable",
"updateActionItemCategory": "Update",
"actionItemCategoryName": "Name",
"actionItemCategoryDetails": "Action Item Category Details",
"enterName": "Enter Name"
"enterName": "Enter Name",
"successfulCreation": "Action Item Category created successfully",
"successfulUpdation": "Action Item Category updated successfully",
"sameNameConflict": "Please change the name to make an update",
"categoryEnabled": "Action Item Category Enabled",
"categoryDisabled": "Action Item Category Disabled"
}
}
20 changes: 19 additions & 1 deletion public/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@
"orgSettings": {
"title": "Paramètre Talawa",
"pageName": "Paramètres",
"generalSettings": "Général",
"actionItemCategorySettings": "Catégories d’éléments d’action",
"updateYourDetails": "Mettre à jour vos informations",
"updateYourPassword": "Mettez à jour votre mot de passe",
"updateOrganization": "Mettre à jour l'organisation",
Expand All @@ -449,7 +451,8 @@
"noData": "Pas de données",
"otherSettings": "Autres paramètres",
"changeLanguage": "Changer la langue",
"manageCustomFields": "Gérer les Champs Personnalisés"
"manageCustomFields": "Gérer les Champs Personnalisés",
"actionItemCategories": "Catégories d’éléments d’action"
},
"deleteOrg": {
"deleteOrganization": "Supprimer l'organisation",
Expand Down Expand Up @@ -724,5 +727,20 @@
"Supprimer le champ personnalisé": "Supprimer le champ personnalisé",
"fieldSuccessMessage": "Champ ajouté avec succès",
"fieldRemovalSuccess": "Champ supprimé avec succès"
},
"orgActionItemCategories": {
"createButton": "Créez",
"editButton": "Éditez",
"enableButton": "Activez",
"disableButton": "Désactivez",
"updateActionItemCategory": "Mettre à jour",
"actionItemCategoryName": "Nom",
"actionItemCategoryDetails": "Détails de la catégorie d’élément d’action",
"enterName": "Entrez le nom",
"successfulCreation": "Catégorie d’élément d’action créée avec succès",
"successfulUpdation": "La catégorie d’élément d’action a été mise à jour avec succès",
"sameNameConflict": "Veuillez modifier le nom pour effectuer une mise à jour",
"categoryEnabled": "Catégorie d’action activée",
"categoryDisabled": "Catégorie d’action désactivée"
}
}
20 changes: 19 additions & 1 deletion public/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@
"orgSettings": {
"title": "तलावा सेटिंग",
"pageName": "सेटिंग्स",
"generalSettings": "सामान्य",
"actionItemCategorySettings": "कार्रवाई आइटम श्रेणियाँ",
"updateYourDetails": "अपना विवरण अपडेट करें",
"updateYourPassword": "अपना पासवर्ड अपडेट करें",
"updateOrganization": "अद्यतन संगठन",
Expand All @@ -449,7 +451,8 @@
"noData": "कोई डेटा नहीं",
"otherSettings": "अन्य सेटिंग्स",
"changeLanguage": "भाषा बदलें",
"manageCustomFields": "कस्टम फ़ील्ड प्रबंधन करें"
"manageCustomFields": "कस्टम फ़ील्ड प्रबंधन करें",
"actionItemCategories": "कार्रवाई आइटम श्रेणियाँ"
},
"deleteOrg": {
"deleteOrganization": "संगठन हटाएं",
Expand Down Expand Up @@ -725,5 +728,20 @@
"Remove Custom Field": "कस्टम फ़ील्ड हटाएँ",
"fieldSuccessMessage": "फ़ील्ड सफलतापूर्वक जोड़ा गया",
"fieldRemovalSuccess": "फ़ील्ड सफलतापूर्वक हटा दिया गया"
},
"orgActionItemCategories": {
"createButton": "बनाएं",
"editButton": "संपादित करें",
"enableButton": "सक्षम करें",
"disableButton": "अक्षम करें",
"updateActionItemCategory": "अद्यतन करें",
"actionItemCategoryName": "नाम",
"actionItemCategoryDetails": "कार्रवाई आइटम श्रेणी विवरण",
"enterName": "नाम दर्ज करें",
"successfulCreation": "कार्रवाई आइटम श्रेणी सफलतापूर्वक बनाई गई",
"successfulUpdation": "क्रिया आइटम श्रेणी सफलतापूर्वक अद्यतन की गई",
"sameNameConflict": "अपडेट करने के लिए कृपया नाम बदलें",
"categoryEnabled": "कार्रवाई आइटम श्रेणी सक्षम",
"categoryDisabled": "क्रिया आइटम श्रेणी अक्षम की गई"
}
}
20 changes: 19 additions & 1 deletion public/locales/sp.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,8 @@
"orgSettings": {
"title": "Configuración Talawa",
"pageName": "Configuración",
"generalSettings": "General",
"actionItemCategorySettings": "Categorías de elementos de acción",
"updateYourDetails": "Actualiza tus datos",
"updateYourPassword": "Actualice su contraseña",
"updateOrganization": "Actualizar Organización",
Expand All @@ -448,7 +450,8 @@
"noData": "Sin datos",
"otherSettings": "Otras Configuraciones",
"changeLanguage": "Cambiar Idioma",
"manageCustomFields": "Gestionar Campos Personalizados"
"manageCustomFields": "Gestionar Campos Personalizados",
"actionItemCategories": "Categorías de elementos de acción"
},
"deleteOrg": {
"deleteOrganization": "Eliminar organización",
Expand Down Expand Up @@ -724,5 +727,20 @@
"Remove Custom Field": "Eliminar Campo Personalizado",
"fieldSuccessMessage": "Campo añadido exitosamente",
"fieldRemovalSuccess": "Campo eliminado exitosamente"
},
"orgActionItemCategories": {
"createButton": "Crear",
"editButton": "Editar",
"enableButton": "Habilitar",
"disableButton": "Inhabilitar",
"updateActionItemCategory": "Actualizar",
"actionItemCategoryName": "Nombre",
"actionItemCategoryDetails": "Detalles de la categoría de elemento de acción",
"enterName": "Introduzca el nombre",
"successfulCreation": "Categoría de elemento de acción creada correctamente",
"successfulUpdation": "Categoría de elemento de acción actualizada correctamente",
"sameNameConflict": "Cambie el nombre para realizar una actualización",
"categoryEnabled": "Categoría de elemento de acción habilitada",
"categoryDisabled": "Categoría de elemento de acción deshabilitada"
}
}
20 changes: 19 additions & 1 deletion public/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@
"orgSettings": {
"title": "塔拉瓦設置",
"pageName": "设置",
"generalSettings": "一般",
"actionItemCategorySettings": "措施项类别",
"updateYourDetails": "更新您的詳細信息",
"updateYourPassword": "更新您的密碼",
"updateOrganization": "更新組織",
Expand All @@ -449,7 +451,8 @@
"noData": "沒有數據",
"otherSettings": "其他设置",
"changeLanguage": "更改语言",
"manageCustomFields": "管理自定义字段"
"manageCustomFields": "管理自定义字段",
"actionItemCategories": "措施项类别"
},
"deleteOrg": {
"deleteOrganization": "删除组织",
Expand Down Expand Up @@ -725,5 +728,20 @@
"删除自定义字段": "删除自定义字段",
"fieldSuccessMessage": "字段添加成功",
"fieldRemovalSuccess": "字段删除成功"
},
"orgActionItemCategories": {
"createButton": "创建",
"editButton": "编辑",
"enableButton": "启用",
"disableButton": "禁用",
"updateActionItemCategory": "更新",
"actionItemCategoryName": "名称",
"actionItemCategoryDetails": "措施项类别详细信息",
"enterName": "输入名称",
"successfulCreation": "已成功创建措施项类别",
"successfulUpdation": "措施项类别已成功更新",
"sameNameConflict": "请更改名称以进行更新",
"categoryEnabled": "已启用措施项类别",
"categoryDisabled": "措施项类别已禁用"
}
}
10 changes: 0 additions & 10 deletions src/GraphQl/Mutations/ActionItemCategoryMutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ export const CREATE_ACTION_ITEM_CATEGORY_MUTATION = gql`
mutation CreateActionItemCategory($name: String!, $organizationId: ID!) {
createActionItemCategory(name: $name, organizationId: $organizationId) {
_id
name
organization {
_id
}
isDisabled
}
}
`;
Expand All @@ -39,11 +34,6 @@ export const UPDATE_ACTION_ITEM_CATEGORY_MUTATION = gql`
data: { name: $name, isDisabled: $isDisabled }
) {
_id
name
organization {
_id
}
isDisabled
}
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
}

.message {
height: 420px;
display: flex;
justify-content: center;
align-items: center;
Expand Down
69 changes: 41 additions & 28 deletions src/components/OrgActionItemCategories/OrgActionItemCategories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import React, { useState } from 'react';
import { Button, Form, Modal } from 'react-bootstrap';
import styles from './OrgActionItemCategories.module.css';
import { useTranslation } from 'react-i18next';
import { toast } from 'react-toastify';
import { WarningAmberRounded } from '@mui/icons-material';

import { useMutation, useQuery } from '@apollo/client';
import {
CREATE_ACTION_ITEM_CATEGORY_MUTATION,
UPDATE_ACTION_ITEM_CATEGORY_MUTATION,
} from 'GraphQl/Mutations/mutations';
import { toast } from 'react-toastify';
import type { InterfaceActionItemCategoryList } from 'utils/interfaces';
import { ACTION_ITEM_CATEGORY_LIST } from 'GraphQl/Queries/ActionItemCategoryQueries';
import type { InterfaceActionItemCategoryList } from 'utils/interfaces';
import Loader from 'components/Loader/Loader';
import { WarningAmberRounded } from '@mui/icons-material';

type ModalType = 'Create' | 'Update';

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

const [name, setName] = useState('');
const [currName, setCurrName] = useState('');

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

Expand Down Expand Up @@ -60,7 +61,7 @@ const OrgActionItemCategories = (): any => {
): Promise<void> => {
e.preventDefault();
try {
const { data } = await createActionItemCategory({
await createActionItemCategory({
variables: {
name,
organizationId: currentUrl,
Expand All @@ -72,8 +73,7 @@ const OrgActionItemCategories = (): any => {

setAddModalIsOpen(false);

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

const handleEdit = async (e: ChangeEvent<HTMLFormElement>): Promise<void> => {
e.preventDefault();
try {
await updateActionItemCategory({
variables: {
actionItemCategoryId: categoryId,
name,
},
});
if (name === currName) {
toast.info(t('sameNameConflict'));
} else {
try {
await updateActionItemCategory({
variables: {
actionItemCategoryId: categoryId,
name,
},
});

setName('');
setCategoryId('');
refetch();
setName('');
setCategoryId('');
refetch();

setAddModalIsOpen(false);
setAddModalIsOpen(false);

toast.success('Action Item Category updated successfully');
} catch (error: any) {
toast.error(error.message);
console.log(error);
toast.success(t('successfulUpdation'));
} catch (error: any) {
toast.error(error.message);
console.log(error);
}
}
};

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

toast.success(
`Action Item Category ${
disabledStatus === true ? 'Enabled' : 'Disabled'
}`
disabledStatus ? t('categoryEnabled') : t('categoryDisabled')
);
} catch (error: any) {
toast.error(error.message);
Expand All @@ -134,6 +136,7 @@ const OrgActionItemCategories = (): any => {
};

const showUpdateModal = (name: string, id: string): void => {
setCurrName(name);
setName(name);
setCategoryId(id);
setModalType('Update');
Expand Down Expand Up @@ -173,23 +176,31 @@ const OrgActionItemCategories = (): any => {
data-testid="saveChangesBtn"
>
<i className={'fa fa-plus me-2'} />
{t('addActionItemCategory')}
{t('createButton')}
</Button>

<div>
{data?.actionItemCategoriesByOrganization.map((category, index) => {
return (
<div key={index}>
<div className="my-3 d-flex justify-content-between align-items-center">
<h6 className="fw-bold mb-0">{category.name}</h6>
<h6
className={
category.isDisabled
? 'text-secondary fw-bold mb-0'
: 'fw-bold mb-0'
}
>
{category.name}
</h6>
<div>
<Button
onClick={() => showUpdateModal(category.name, category._id)}
size="sm"
variant="secondary"
className="me-2"
>
Edit
{t('editButton')}
</Button>
<Button
onClick={() =>
Expand All @@ -198,7 +209,9 @@ const OrgActionItemCategories = (): any => {
size="sm"
variant={category.isDisabled ? 'outline-success' : 'danger'}
>
{category.isDisabled ? 'Enable' : 'Disable'}
{category.isDisabled
? t('enableButton')
: t('disableButton')}
</Button>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/screens/OrgSettings/OrgSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function orgSettings(): JSX.Element {
}
onClick={() => setSetting('General')}
>
General
{t('generalSettings')}
</Button>
<Button
className="border rounded-3"
Expand All @@ -49,7 +49,7 @@ function orgSettings(): JSX.Element {
}
onClick={() => setSetting('ActionItemCategories')}
>
Action Item Categories
{t('actionItemCategorySettings')}
</Button>
</Col>

Expand Down

0 comments on commit 82491b0

Please sign in to comment.