Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
feat(i18n): update and resolve testing and lint issues
Browse files Browse the repository at this point in the history
fix #1668
  • Loading branch information
ocBruno committed Jan 31, 2020
1 parent 0726ac3 commit d9b7722
Show file tree
Hide file tree
Showing 51 changed files with 241 additions and 271 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/patients/patients-slice.test.ts
Expand Up @@ -133,7 +133,7 @@ describe('patients slice', () => {
expect(mockedComponents.Toast).toHaveBeenCalledWith(
'success',
'Success!',
`Successfully created patient ${expectedGivenName} ${expectedFamilyName} ${expectedSuffix}`,
`patients.successfullyCreated ${expectedGivenName} ${expectedFamilyName} ${expectedSuffix}`,
)
})
})
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/scheduling/appointments-slice.test.ts
Expand Up @@ -2,11 +2,11 @@ import { AnyAction } from 'redux'
import Appointment from 'model/Appointment'
import { createMemoryHistory } from 'history'
import AppointmentRepository from 'clients/db/AppointmentsRepository'
import { mocked } from 'ts-jest/utils'
import appointments, {
createAppointmentStart,
createAppointment,
} from '../../scheduling/appointments/appointments-slice'
import { mocked } from 'ts-jest/utils'

describe('appointments slice', () => {
describe('appointments reducer', () => {
Expand Down
12 changes: 6 additions & 6 deletions src/components/Navbar.tsx
Expand Up @@ -18,13 +18,15 @@ const Navbar = () => {
bg="dark"
variant="dark"
search={{
onClickButton: () => console.log('hello'),
onChangeInput: () => console.log('hello'),
buttonText: 'actions.search',
placeholderText: 'actions.search',
onClickButton: () => undefined,
onChangeInput: () => undefined,
}}
navLinks={[
{
label: t('patients.label', 'patients'),
onClick: () => {},
onClick: () => undefined,
children: [
{
label: t('actions.list', 'list'),
Expand All @@ -42,9 +44,7 @@ const Navbar = () => {
},
{
label: t('scheduling.label'),
onClick: () => {
// no oop
},
onClick: () => undefined,
children: [
{
label: t('scheduling.appointments.label'),
Expand Down
30 changes: 0 additions & 30 deletions src/i18n.js

This file was deleted.

32 changes: 16 additions & 16 deletions src/i18n.ts
@@ -1,16 +1,16 @@
import i18n from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';
import i18n from 'i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
import { initReactI18next } from 'react-i18next'

import translationAR from './locales/ar/translations';
import translationDE from './locales/de/translations';
import translationEN from './locales/en/translations';
import translationES from './locales/es/translations';
import translationIN from './locales/in/translations';
import translationJA from './locales/ja/translations';
import translationPT from './locales/pt/translations';
import translationRU from './locales/ru/translations';
import translationZR from './locales/zr/translations';
import translationAR from './locales/ar/translations'
import translationDE from './locales/de/translations'
import translationEN from './locales/en/translations'
import translationES from './locales/es/translations'
import translationIN from './locales/in/translations'
import translationJA from './locales/ja/translations'
import translationPT from './locales/pt/translations'
import translationRU from './locales/ru/translations'
import translationZR from './locales/zr/translations'

const resources = {
ar: {
Expand Down Expand Up @@ -40,7 +40,7 @@ const resources = {
zr: {
translation: translationZR,
},
};
}

i18n
// load translation using xhr -> see /public/locales
Expand All @@ -55,10 +55,10 @@ i18n
.init({
fallbackLng: 'en',
debug: true,
resources: resources,
resources,
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
},
});
})

export default i18n;
export default i18n
2 changes: 1 addition & 1 deletion src/index.tsx
Expand Up @@ -4,7 +4,7 @@ import '@hospitalrun/components/scss/main.scss'
import './index.css'
import App from './App'
import * as serviceWorker from './serviceWorker'
import './i18n.ts'
import './i18n'

ReactDOM.render(<App />, document.getElementById('root'))

Expand Down
14 changes: 7 additions & 7 deletions src/locales/ar/translations/actions/index.ts
@@ -1,9 +1,9 @@
export default {
"actions": {
"edit": "تصحيح",
"save": "حفظ",
"cancel": "إلغاء",
"new": "الجديد",
"list": "قائمة"
}
actions: {
edit: 'تصحيح',
save: 'حفظ',
cancel: 'إلغاء',
new: 'الجديد',
list: 'قائمة',
},
}
6 changes: 3 additions & 3 deletions src/locales/ar/translations/dashboard/index.ts
@@ -1,5 +1,5 @@
export default {
"dashboard": {
"label": "لوحة القيادة"
}
dashboard: {
label: 'لوحة القيادة',
},
}
8 changes: 4 additions & 4 deletions src/locales/ar/translations/index.ts
@@ -1,7 +1,7 @@
import actions from './actions';
import dashboard from './dashboard';
import patient from './patient';
import patients from './patients';
import actions from './actions'
import dashboard from './dashboard'
import patient from './patient'
import patients from './patients'

export default {
...actions,
Expand Down
8 changes: 4 additions & 4 deletions src/locales/ar/translations/patient/index.ts
@@ -1,6 +1,6 @@
export default {
"patient": {
"firstName": "الاسم الاول",
"lastName": "الكنية"
}
patient: {
firstName: 'الاسم الاول',
lastName: 'الكنية',
},
}
12 changes: 6 additions & 6 deletions src/locales/ar/translations/patients/index.ts
@@ -1,8 +1,8 @@
export default {
"patients": {
"label": "المرضى",
"viewPatients": "عرض المرضى",
"viewPatient": "عرض المريض",
"newPatient": "مريض جديد"
}
patients: {
label: 'المرضى',
viewPatients: 'عرض المرضى',
viewPatient: 'عرض المريض',
newPatient: 'مريض جديد',
},
}
14 changes: 7 additions & 7 deletions src/locales/de/translations/actions/index.ts
@@ -1,9 +1,9 @@
export default {
"actions": {
"edit": "Bearbeiten",
"save": "speichern",
"cancel": "Stornieren",
"new": "Neu",
"list": "Liste"
}
actions: {
edit: 'Bearbeiten',
save: 'speichern',
cancel: 'Stornieren',
new: 'Neu',
list: 'Liste',
},
}
6 changes: 3 additions & 3 deletions src/locales/de/translations/dashboard/index.ts
@@ -1,5 +1,5 @@
export default {
"dashboard": {
"label": "Instrumententafel"
}
dashboard: {
label: 'Instrumententafel',
},
}
8 changes: 4 additions & 4 deletions src/locales/de/translations/index.ts
@@ -1,7 +1,7 @@
import actions from './actions';
import dashboard from './dashboard';
import patient from './patient';
import patients from './patients';
import actions from './actions'
import dashboard from './dashboard'
import patient from './patient'
import patients from './patients'

export default {
...actions,
Expand Down
8 changes: 4 additions & 4 deletions src/locales/de/translations/patient/index.ts
@@ -1,6 +1,6 @@
export default {
"patient": {
"firstName": "Vorname",
"lastName": "Nachname"
}
patient: {
firstName: 'Vorname',
lastName: 'Nachname',
},
}
12 changes: 6 additions & 6 deletions src/locales/de/translations/patients/index.ts
@@ -1,8 +1,8 @@
export default {
"patients": {
"label": "Patienten",
"viewPatients": "Patienten anzeigen",
"viewPatient": "Patient anzeigen",
"newPatient": "Neuer Patient"
}
patients: {
label: 'Patienten',
viewPatients: 'Patienten anzeigen',
viewPatient: 'Patient anzeigen',
newPatient: 'Neuer Patient',
},
}
14 changes: 7 additions & 7 deletions src/locales/en/translations/actions/index.ts
@@ -1,9 +1,9 @@
export default {
"actions": {
"edit": "Edit",
"save": "Save",
"cancel": "Cancel",
"new": "New",
"list": "List"
}
actions: {
edit: 'Edit',
save: 'Save',
cancel: 'Cancel',
new: 'New',
list: 'List',
},
}
6 changes: 3 additions & 3 deletions src/locales/en/translations/dashboard/index.ts
@@ -1,5 +1,5 @@
export default {
"dashboard": {
"label": "Dashboard"
}
dashboard: {
label: 'Dashboard',
},
}
8 changes: 4 additions & 4 deletions src/locales/en/translations/index.ts
@@ -1,7 +1,7 @@
import actions from './actions';
import dashboard from './dashboard';
import patient from './patient';
import patients from './patients';
import actions from './actions'
import dashboard from './dashboard'
import patient from './patient'
import patients from './patients'

export default {
...actions,
Expand Down
8 changes: 4 additions & 4 deletions src/locales/en/translations/patient/index.ts
@@ -1,6 +1,6 @@
export default {
"patient": {
"firstName": "First Name",
"lastName": "Last Name"
}
patient: {
firstName: 'First Name',
lastName: 'Last Name',
},
}
12 changes: 6 additions & 6 deletions src/locales/en/translations/patients/index.ts
@@ -1,8 +1,8 @@
export default {
"patients": {
"label": "Patients",
"viewPatients": "View Patients",
"viewPatient": "View Patient",
"newPatient": "New Patient"
}
patients: {
label: 'Patients',
viewPatients: 'View Patients',
viewPatient: 'View Patient',
newPatient: 'New Patient',
},
}
14 changes: 7 additions & 7 deletions src/locales/es/translations/actions/index.ts
@@ -1,9 +1,9 @@
export default {
"actions": {
"edit": "Editar",
"save": "Guardar",
"cancel": "Cancelar",
"new": "Nuevo",
"list": "Lista"
}
actions: {
edit: 'Editar',
save: 'Guardar',
cancel: 'Cancelar',
new: 'Nuevo',
list: 'Lista',
},
}
6 changes: 3 additions & 3 deletions src/locales/es/translations/dashboard/index.ts
@@ -1,5 +1,5 @@
export default {
"dashboard": {
"label": "Panel"
}
dashboard: {
label: 'Panel',
},
}
8 changes: 4 additions & 4 deletions src/locales/es/translations/index.ts
@@ -1,7 +1,7 @@
import actions from './actions';
import dashboard from './dashboard';
import patient from './patient';
import patients from './patients';
import actions from './actions'
import dashboard from './dashboard'
import patient from './patient'
import patients from './patients'

export default {
...actions,
Expand Down
8 changes: 4 additions & 4 deletions src/locales/es/translations/patient/index.ts
@@ -1,6 +1,6 @@
export default {
"patient": {
"firstName": "Nombre de pila",
"lastName": "Apellido"
}
patient: {
firstName: 'Nombre de pila',
lastName: 'Apellido',
},
}
12 changes: 6 additions & 6 deletions src/locales/es/translations/patients/index.ts
@@ -1,8 +1,8 @@
export default {
"patients": {
"label": "Pacientes",
"viewPatients": "Ver pacientes",
"viewPatient": "Ver pacientes",
"newPatient": "Nuevo paciente"
}
patients: {
label: 'Pacientes',
viewPatients: 'Ver pacientes',
viewPatient: 'Ver pacientes',
newPatient: 'Nuevo paciente',
},
}

0 comments on commit d9b7722

Please sign in to comment.