Skip to content

Commit

Permalink
[Translation] Organisation related pages (#2029)
Browse files Browse the repository at this point in the history
* OrgPeople screen translations

* venues screen fix

* Action Itme screen fix

* Action Itme screen fix

* .

* fix screens

* chore: Update EditCustomFieldDropDown test to use i18nForTest provider
  • Loading branch information
pranshugupta54 authored Jun 4, 2024
1 parent 126c368 commit ebb69a8
Show file tree
Hide file tree
Showing 19 changed files with 109 additions and 39 deletions.
8 changes: 7 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"emailAddress": "Email Address",
"email": "Email",
"name": "Name",
"desc": "Description",
"enterPassword": "Enter Password",
"password": "Password",
"confirmPassword": "Confirm Password",
Expand Down Expand Up @@ -70,5 +71,10 @@
"action": "Action",
"removeUser": "Remove User",
"remove": "Remove",
"viewProfile": "View Profile"
"viewProfile": "View Profile",
"profile": "Profile",
"noFiltersApplied": "No filters applied",
"manage": "Manage",
"searchResultsFor": "Search results for {{text}}",
"none": "None"
}
8 changes: 7 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@
"clearFilters": "Clear Filters",
"completed": "Completed",
"completionDate": "Completion Date",
"createActionItem": "Create Action Items",
"deleteActionItem": "Delete Action Item",
"deleteActionItemMsg": "Do you want to remove this action item?",
"details": "Details",
Expand Down Expand Up @@ -566,6 +567,7 @@
"addOnStore": {
"title": "Add On Store",
"searchName": "Ex: Donations",
"search": "Search",
"enable": "Enabled",
"disable": "Disabled",
"pHeading": "Plugins",
Expand Down Expand Up @@ -811,7 +813,11 @@
"customFieldType": "Field Type",
"Remove Custom Field": "Remove Custom Field",
"fieldSuccessMessage": "Field added successfully",
"fieldRemovalSuccess": "Field removed successfully"
"fieldRemovalSuccess": "Field removed successfully",
"String": "String",
"Boolean": "Boolean",
"Date": "Date",
"Number": "Number"
},
"orgActionItemCategories": {
"enableButton": "Enable",
Expand Down
8 changes: 7 additions & 1 deletion public/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"emailAddress": "Adresse e-mail",
"email": "E-mail",
"name": "Nom",
"desc": "Description",
"enterPassword": "Entrer le mot de passe",
"password": "Mot de passe",
"confirmPassword": "Confirmez le mot de passe",
Expand Down Expand Up @@ -70,5 +71,10 @@
"action": "Action",
"removeUser": "Supprimer l'Utilisateur",
"remove": "Supprimer",
"viewProfile": "Voir le Profil"
"viewProfile": "Voir le Profil",
"profile": "Profil",
"noFiltersApplied": "Aucun filtre appliqué",
"manage": "Gérer",
"searchResultsFor": "Résultats de recherche pour {{text}}",
"none": "Aucun"
}
8 changes: 7 additions & 1 deletion public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
"clearFilters": "Effacer les filtres",
"completed": "Complété",
"completionDate": "Date d'achèvement",
"createActionItem": "Créer un élément d'action",
"deleteActionItem": "Supprimer l'élément d'action",
"deleteActionItemMsg": "Voulez-vous supprimer cette action ?",
"details": "Détails",
Expand Down Expand Up @@ -571,6 +572,7 @@
"addOnStore": {
"title": "Ajouter sur la boutique",
"searchName": "Ex : Dons",
"search": "Rechercher",
"enable": "Activé",
"disable": "Désactivé",
"pHeading": "Plugins",
Expand Down Expand Up @@ -818,7 +820,11 @@
"customFieldType": "Type de champ",
"Remove Custom Field": "Supprimer le champ personnalisé",
"fieldSuccessMessage": "Champ ajouté avec succès",
"fieldRemovalSuccess": "Champ supprimé avec succès"
"fieldRemovalSuccess": "Champ supprimé avec succès",
"String": "Chaîne",
"Boolean": "Booléen",
"Date": "Date",
"Number": "Nombre"
},
"orgActionItemCategories": {
"enableButton": "Activer",
Expand Down
8 changes: 7 additions & 1 deletion public/locales/hi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"emailAddress": "मेल पता",
"email": "ईमेल",
"name": "नाम",
"desc": "विवरण",
"enterPassword": "पास वर्ड दर्ज करें",
"password": "पासवर्ड",
"confirmPassword": "पासवर्ड की पुष्टि कीजिये",
Expand Down Expand Up @@ -70,5 +71,10 @@
"action": "क्रिया",
"removeUser": "उपयोगकर्ता हटाएं",
"remove": "हटाएं",
"viewProfile": "प्रोफ़ाइल देखें"
"viewProfile": "प्रोफ़ाइल देखें",
"profile": "प्रोफ़ाइल",
"noFiltersApplied": "कोई फ़िल्टर लागू नहीं हैं",
"manage": "प्रबंधित करें",
"searchResultsFor": "{{text}} के लिए खोज परिणाम",
"none": "कोई नहीं"
}
8 changes: 7 additions & 1 deletion public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
"clearFilters": "फ़िल्टर साफ़ करें",
"completed": "पुरा होना।",
"completionDate": "पूरा करने की तिथि",
"createActionItem": "कार्रवाई आइटम बनाएं",
"deleteActionItem": "क्रिया आइटम हटाएँ",
"deleteActionItemMsg": "क्या आप इस क्रिया आइटम को हटाना चाहते हैं?",
"details": "विवरण",
Expand Down Expand Up @@ -571,6 +572,7 @@
"addOnStore": {
"title": "स्टोर पर जोड़ें",
"searchName": "उदाहरणार्थ: दान",
"search": "खोजें",
"enable": "सक्रिय",
"disable": "अक्षम",
"pHeading": "प्लग-इन",
Expand Down Expand Up @@ -818,7 +820,11 @@
"customFieldType": "क्षेत्र प्रकार",
"Remove Custom Field": "कस्टम फ़ील्ड हटाएँ",
"fieldSuccessMessage": "फ़ील्ड सफलतापूर्वक जोड़ा गया",
"fieldRemovalSuccess": "फ़ील्ड सफलतापूर्वक हटा दी गई"
"fieldRemovalSuccess": "फ़ील्ड सफलतापूर्वक हटा दी गई",
"String": "स्ट्रिंग",
"Boolean": "बूलियन",
"Date": "तारीख",
"Number": "संख्या"
},
"orgActionItemCategories": {
"enableButton": "सक्षम",
Expand Down
8 changes: 7 additions & 1 deletion public/locales/sp/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"emailAddress": "Email Address",
"email": "Email",
"name": "Name",
"desc": "Description",
"enterPassword": "Enter Password",
"password": "Password",
"confirmPassword": "Confirm Password",
Expand Down Expand Up @@ -70,5 +71,10 @@
"action": "Acción",
"removeUser": "Eliminar Usuario",
"remove": "Eliminar",
"viewProfile": "Ver Perfil"
"viewProfile": "Ver Perfil",
"profile": "Perfil",
"noFiltersApplied": "No se aplicaron filtros",
"manage": "Administrar",
"searchResultsFor": "Resultados de búsqueda para {{text}}",
"none": "Ninguno"
}
12 changes: 8 additions & 4 deletions public/locales/sp/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@
"close": "Cerrar",
"completed": "Completado",
"completionDate": "Fecha de finalización",
"createActionItem": "Crear",
"createActionItem": "Crear ítem de acción",
"deleteActionItem": "Eliminar ítem de acción",
"deleteActionItemMsg": "¿Desea eliminar este ítem de acción?",
"details": "Detalles",
Expand Down Expand Up @@ -753,14 +753,14 @@
"addOnStore": {
"title": "Tienda de complementos",
"searchName": "Ej: Donaciones",
"search": "Buscar",
"enable": "Activada",
"disable": "Desactivada",
"pHeading": "Complementos",
"install": "Instalada",
"available": "Disponible",
"pMessage": "El complemento no existe",
"filter": "filtros",
"search": "Buscar"
"filter": "filtros"
},
"addOnEntry": {
"enable": "Activada",
Expand Down Expand Up @@ -1044,7 +1044,11 @@
"saveChanges": "Guardar Cambios",
"Remove Custom Field": "Eliminar Campo Personalizado",
"fieldSuccessMessage": "Campo añadido exitosamente",
"fieldRemovalSuccess": "Campo eliminado exitosamente"
"fieldRemovalSuccess": "Campo eliminado exitosamente",
"String": "Cadena",
"Boolean": "Booleano",
"Date": "Fecha",
"Number": "Número"
},
"orgActionItemCategories": {
"createButton": "Crear",
Expand Down
8 changes: 7 additions & 1 deletion public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"emailAddress": "电子邮件地址",
"email": "电子邮件",
"name": "姓名",
"desc": "描述",
"enterPassword": "输入密码",
"password": "密码",
"confirmPassword": "确认密码",
Expand Down Expand Up @@ -70,5 +71,10 @@
"action": "操作",
"removeUser": "删除用户",
"remove": "删除",
"viewProfile": "查看个人资料"
"viewProfile": "查看个人资料",
"profile": "轮廓",
"noFiltersApplied": "未应用筛选器",
"manage": "管理",
"searchResultsFor": "搜索结果:{{text}}",
"none": "没有"
}
8 changes: 7 additions & 1 deletion public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
"clearFilters": "清除过滤器",
"completed": "完全的",
"completionDate": "完成日期",
"createActionItem": "创建操作项",
"deleteActionItem": "删除操作项",
"deleteActionItemMsg": "您想删除此操作项吗?",
"details": "细节",
Expand Down Expand Up @@ -571,6 +572,7 @@
"addOnStore": {
"title": "添加商店",
"searchName": "例如:捐款",
"search": "搜索",
"enable": "启用",
"disable": "残疾人",
"pHeading": "插件",
Expand Down Expand Up @@ -818,7 +820,11 @@
"customFieldType": "字段类型",
"Remove Custom Field": "删除自定义字段",
"fieldSuccessMessage": "字段添加成功",
"fieldRemovalSuccess": "字段删除成功"
"fieldRemovalSuccess": "字段删除成功",
"String": "字符串",
"Boolean": "布尔值",
"Date": "日期",
"Number": "数字"
},
"orgActionItemCategories": {
"enableButton": "使能够",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import EditOrgCustomFieldDropDown from './EditCustomFieldDropDown';
import type { InterfaceCustomFieldData } from 'components/OrgProfileFieldSettings/OrgProfileFieldSettings';
import userEvent from '@testing-library/user-event';
import availableFieldTypes from 'utils/fieldTypes';
import { I18nextProvider } from 'react-i18next';
import i18nForTest from 'utils/i18nForTest';

async function wait(ms = 100): Promise<void> {
await act(() => {
Expand Down Expand Up @@ -39,7 +41,9 @@ describe('Testing Custom Field Dropdown', () => {

const { getByTestId, getByText } = render(
<BrowserRouter>
<EditOrgCustomFieldDropDown {...props} />
<I18nextProvider i18n={i18nForTest}>
<EditOrgCustomFieldDropDown {...props} />
</I18nextProvider>
</BrowserRouter>,
);

Expand Down
32 changes: 20 additions & 12 deletions src/components/EditCustomFieldDropDown/EditCustomFieldDropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { SetStateAction, Dispatch } from 'react';
import { Dropdown } from 'react-bootstrap';
import availableFieldTypes from 'utils/fieldTypes';
import type { InterfaceCustomFieldData } from 'components/OrgProfileFieldSettings/OrgProfileFieldSettings';
import { useTranslation } from 'react-i18next';

interface InterfaceEditCustomFieldDropDownProps {
customFieldData: InterfaceCustomFieldData;
Expand All @@ -11,38 +12,45 @@ interface InterfaceEditCustomFieldDropDownProps {
btnStyle?: string;
btnTextStyle?: string;
}
[];

const EditOrgCustomFieldDropDown = (
props: InterfaceEditCustomFieldDropDownProps,
): JSX.Element => {
const EditOrgCustomFieldDropDown = ({
customFieldData,
setCustomFieldData,
parentContainerStyle,
btnStyle,
}: InterfaceEditCustomFieldDropDownProps): JSX.Element => {
const { t } = useTranslation('translation', {
keyPrefix: 'orgProfileField',
});
const { t: tCommon } = useTranslation('common');

return (
<Dropdown
title="Edit Custom Field"
className={`${props?.parentContainerStyle ?? ''}`}
className={`${parentContainerStyle ?? ''}`}
>
<Dropdown.Toggle
variant="outline-success"
className={`${props?.btnStyle ?? ''}`}
className={`${btnStyle ?? ''}`}
data-testid="toggleBtn"
>
{props.customFieldData.type || 'None'}
{customFieldData.type ? t(customFieldData.type) : tCommon('none')}
</Dropdown.Toggle>
<Dropdown.Menu>
{availableFieldTypes.map((customFieldType, index: number) => (
<Dropdown.Item
key={`dropdown-item-${index}`}
className={`dropdown-item`}
className="dropdown-item"
data-testid={`dropdown-btn-${index}`}
onClick={(): void => {
props.setCustomFieldData({
...props.customFieldData,
setCustomFieldData({
...customFieldData,
type: customFieldType,
});
}}
disabled={props.customFieldData.type == customFieldType}
disabled={customFieldData.type === customFieldType}
>
{customFieldType}
{t(customFieldType)}
</Dropdown.Item>
))}
</Dropdown.Menu>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ function eventActionItems(props: { eventId: string }): JSX.Element {
</Form.Select>
</Form.Group>
<Form.Group className="mb-3">
<Form.Label>Assignee</Form.Label>
<Form.Label>{t('assignee')}</Form.Label>
<Form.Select
data-testid="formSelectAssignee"
required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const ActionItemCreateModal: React.FC<InterfaceActionItemCreateModalProps> = ({
</Form.Group>

<Form.Group className="mb-3">
<Form.Label>Assignee</Form.Label>
<Form.Label>{t('assignee')}</Form.Label>
<Form.Select
data-testid="formSelectAssignee"
required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const ActionItemUpdateModal: React.FC<InterfaceActionItemCreateModalProps> = ({
<Modal.Body>
<Form onSubmitCapture={updateActionItemHandler}>
<Form.Group className="mb-2">
<Form.Label>Assignee</Form.Label>
<Form.Label>{t('assignee')}</Form.Label>
<Form.Select
data-testid="formUpdateAssignee"
defaultValue=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ function organizationActionItems(): JSX.Element {
<div className=" d-none d-lg-inline flex-grow-1 d-flex align-items-center border bg-light-subtle rounded-3">
{!actionItemCategoryName && !actionItemStatus && (
<div className="lh-lg mt-2 text-center fw-semibold text-body-tertiary">
No Filters
{tCommon('noFiltersApplied')}
</div>
)}

Expand Down
2 changes: 1 addition & 1 deletion src/screens/OrganizationFunds/OrganizationFunds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ const organizationFunds = (): JSX.Element => {
data-testid="editFundBtn"
onClick={() => handleEditClick(fund)}
>
Manage
{tCommon('manage')}
</Button>
</StyledTableCell>
</StyledTableRow>
Expand Down
Loading

0 comments on commit ebb69a8

Please sign in to comment.