Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) Add translations for generic widget and patient chart pagination #1376

Merged
merged 20 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3bd4b57
Translations for generic widget and patient chart pagination
vasharma05 Sep 27, 2023
f6a3259
All in the encounters table needs to be translated
vasharma05 Sep 28, 2023
97360a5
Merge branch 'main' of https://www.github.com/openmrs/openmrs-esm-pat…
vasharma05 Sep 28, 2023
993c213
Merge branch 'main' of https://www.github.com/openmrs/openmrs-esm-pat…
vasharma05 Oct 4, 2023
c5aaf5f
Updated translation files
vasharma05 Oct 4, 2023
7e6d29f
Merge branch 'main' into pagination-generic-translations
vasharma05 Oct 5, 2023
b7bceec
Merge branch 'main' of https://www.github.com/openmrs/openmrs-esm-pat…
vasharma05 Oct 9, 2023
ccef832
Updated the translation files
vasharma05 Oct 9, 2023
cc8bf76
Merge branch 'pagination-generic-translations' of https://www.github.…
vasharma05 Oct 9, 2023
a112697
Merge branch 'main' into pagination-generic-translations
vasharma05 Oct 13, 2023
81ffed0
Added km translation for date and time
vasharma05 Oct 13, 2023
076965a
Added km translation for pagination
vasharma05 Oct 13, 2023
d44e095
Merge branch 'main' of https://www.github.com/openmrs/openmrs-esm-pat…
vasharma05 Oct 16, 2023
7c71284
Updated translations
vasharma05 Oct 16, 2023
0f3d472
Merge branch 'pagination-generic-translations' of https://www.github.…
vasharma05 Oct 16, 2023
c54c1bd
Merge branch 'main' into pagination-generic-translations
denniskigen Oct 17, 2023
d3b384b
Merge branch 'main' of https://www.github.com/openmrs/openmrs-esm-pat…
vasharma05 Oct 17, 2023
bbd0c8b
Merge branch 'main' into pagination-generic-translations
vasharma05 Oct 17, 2023
5bea8ba
Using pluralization for the translation
vasharma05 Oct 17, 2023
59b1a28
Merge branch 'pagination-generic-translations' of https://www.github.…
vasharma05 Oct 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ import { usePagination, useConfig, formatDatetime, formatDate, formatTime } from
import { PatientChartPagination } from '@openmrs/esm-patient-common-lib';
import { useObs } from '../resources/useObs';
import styles from './obs-table.scss';
import { useTranslation } from 'react-i18next';

interface ObsTableProps {
patientUuid: string;
}

const ObsTable: React.FC<ObsTableProps> = ({ patientUuid }) => {
const { t } = useTranslation();
const config = useConfig();
const { data: obss, error, isLoading, isValidating } = useObs(patientUuid);
const uniqueDates = [...new Set(obss.map((o) => o.issued))].sort();
const obssByDate = uniqueDates.map((date) => obss.filter((o) => o.issued === date));

const tableHeaders = [
{ key: 'date', header: 'Date and time', isSortable: true },
{ key: 'date', header: t('dateAndTime', 'Date and time'), isSortable: true },
...config.data.map(({ concept, label }) => ({
key: concept,
header: label,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"chartView": "Chart View",
"dateAndTime": "Date and time",
"displaying": "Displaying",
"tableView": "Table View"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"chartView": "عرض الرسم البياني",
"dateAndTime": "Date and time",
"displaying": "عرض",
"tableView": "عرض الجدول"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"chartView": "Chart View",
"dateAndTime": "Date and time",
"displaying": "Displaying",
"tableView": "Table View"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"chartView": "Vista de gráfico",
"dateAndTime": "Date and time",
"displaying": "Visualización",
"tableView": "Vista de tabla"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"chartView": "Vue graphique",
"dateAndTime": "Date and time",
"displaying": "En cours d'affichage",
"tableView": "Vue tabulaire"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"chartView": "תצוגת תרשים",
"dateAndTime": "Date and time",
"displaying": "מציג",
"tableView": "תצוגת טבלה"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"chartView": "មើលគំនូសតាង",
"dateAndTime": "កាលបរិច្ឆេទ និងម៉ោង",
"displaying": "ការបង្ហាញ",
"tableView": "មើលតារាង"
}
1 change: 1 addition & 0 deletions packages/esm-patient-chart-app/src/root.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default function Root() {
/**
* DO NOT REMOVE THIS COMMENT
* THE TRANSLATION KEYS AND VALUES USED IN THE COMMON LIB IS WRITTEN HERE
* t('paginationPageText', 'of {count} pages', {count})
Comment on lines 39 to +40
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* THE TRANSLATION KEYS AND VALUES USED IN THE COMMON LIB IS WRITTEN HERE
* t('paginationPageText', 'of {count} pages', {count})
* The following are translation keys and strings for components in `esm-patient-common-lib`
* t('paginationPageText', 'of {total} pages')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @denniskigen !
The count variable is used for pluralization purpose, and hence it was renamed.

* t("emptyStateText", 'There are no {displayText} to display for this patient', {displayText: "sample text"})
* t('record', 'Record')
* t('errorCopy','Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@ const VisitTable: React.FC<VisitTableProps> = ({ showAllEncounters, visits, pati
<div className={styles.filterContainer}>
<Dropdown
id="serviceFilter"
initialSelectedItem={'All'}
initialSelectedItem={t('all', 'All')}
label=""
titleText={t('filterByEncounterType', 'Filter by encounter type') + ':'}
type="inline"
items={['All', ...encounterTypes]}
items={[t('all', 'All'), ...encounterTypes]}
onChange={handleEncounterTypeChange}
size={desktopLayout ? 'sm' : 'lg'}
/>
Expand Down
2 changes: 2 additions & 0 deletions packages/esm-patient-chart-app/translations/am.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
"orderDurationAndUnit": "for {duration} {durationUnit}",
"orderIndefiniteDuration": "Indefinite duration",
"other": "Other",
"paginationPageText_one": "of {count} page",
"paginationPageText_other": "of {count} pages",
"partOfFormDidntLoad": "Part of the form did not load",
"pastVisitErrorText": "Past Visit Error",
"pastVisits": "Past Visits",
Expand Down
6 changes: 6 additions & 0 deletions packages/esm-patient-chart-app/translations/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@
"orderDurationAndUnit": "لمدة {duration} {durationUnit}",
"orderIndefiniteDuration": "مدة غير محددة",
"other": "أخرى",
"paginationPageText_zero": "of {count} pages",
"paginationPageText_one": "of {count} page",
"paginationPageText_two": "of {count} pages",
"paginationPageText_few": "of {count} pages",
"paginationPageText_many": "of {count} pages",
"paginationPageText_other": "of {count} pages",
"partOfFormDidntLoad": "جزء من النموذج لم يتم تحميله",
"pastVisitErrorText": "خطأ في الزيارات السابقة",
"pastVisits": "الزيارات السابقة",
Expand Down
2 changes: 2 additions & 0 deletions packages/esm-patient-chart-app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
"orderDurationAndUnit": "for {duration} {durationUnit}",
"orderIndefiniteDuration": "Indefinite duration",
"other": "Other",
"paginationPageText_one": "of {count} page",
"paginationPageText_other": "of {count} pages",
"partOfFormDidntLoad": "Part of the form did not load",
"pastVisitErrorText": "Past Visit Error",
"pastVisits": "Past Visits",
Expand Down
3 changes: 3 additions & 0 deletions packages/esm-patient-chart-app/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
"orderDurationAndUnit": "para {duration} {durationUnit}",
"orderIndefiniteDuration": "Duración indefinida",
"other": "Otros",
"paginationPageText_one": "of {count} page",
"paginationPageText_many": "of {count} pages",
"paginationPageText_other": "of {count} pages",
"partOfFormDidntLoad": "Parte del formulario no se cargó",
"pastVisitErrorText": "Error de visita pasada",
"pastVisits": "Visitas pasadas",
Expand Down
3 changes: 3 additions & 0 deletions packages/esm-patient-chart-app/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
"orderDurationAndUnit": "pour {duration} {durationUnit}",
"orderIndefiniteDuration": "Durée indéfinie",
"other": "Autre",
"paginationPageText_one": "of {count} page",
"paginationPageText_many": "of {count} pages",
"paginationPageText_other": "of {count} pages",
"partOfFormDidntLoad": "Part of the form did not load",
"pastVisitErrorText": "Erreur de visite passée",
"pastVisits": "Visites passées",
Expand Down
4 changes: 4 additions & 0 deletions packages/esm-patient-chart-app/translations/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@
"orderDurationAndUnit": "למשך {duration} {durationUnit}",
"orderIndefiniteDuration": "למשך זמן בלתי מוגבל",
"other": "אחר",
"paginationPageText_one": "of {count} page",
"paginationPageText_two": "of {count} pages",
"paginationPageText_many": "of {count} pages",
"paginationPageText_other": "of {count} pages",
"partOfFormDidntLoad": "Part of the form did not load",
"pastVisitErrorText": "שגיאה בביקור עבר",
"pastVisits": "ביקורים עבריים",
Expand Down
1 change: 1 addition & 0 deletions packages/esm-patient-chart-app/translations/km.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"orderDurationAndUnit": "សម្រាប់ {រយៈពេល} {ឯកតារយៈពេលt}",
"orderIndefiniteDuration": "រយៈពេលមិនកំណត់",
"other": "ផ្សេងទៀត",
"paginationPageText_other": "of {count} pages",
"partOfFormDidntLoad": "ទម្រង់មួយផ្នែកមិនមានទិន្នន័យទេ",
"pastVisitErrorText": "កំហុសក្នុងការមកពិនិត្យជំងឺកន្លងមក",
"pastVisits": "ការមកពិនិត្យជំងឺកន្លងមក",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const PatientChartPagination: React.FC<PatientChartPaginationProps> = ({
pageSizes={pageSizes}
totalItems={totalItems}
onChange={onPageNumberChange}
pageRangeText={(_, total) => t('pageCountText', 'of {count} pages', { count: total })}
size={isTablet ? 'lg' : 'sm'}
/>
</div>
Expand Down
2 changes: 2 additions & 0 deletions packages/esm-patient-flags-app/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"editFlags": "Editar banderas",
"enabledFlag": "Bandera activada",
"enablingFlag": "Activando bandera...",
"flagCountfalsemany": "{count} risk flag{plural}",
"flagCountfalseone": "{count} bandera de riesgo",
"flagCountfalseother": "{count} banderas de riesgo",
"flagDisabled": "Bandera desactivada",
Expand All @@ -19,6 +20,7 @@
"flagEnabledSuccessfully": "Bandera activada con éxito",
"flagEnableError": "Error al activar la bandera",
"loading": "Cargando",
"matchesForSearchTermfalsemany": "{count} flag{plural}",
vasharma05 marked this conversation as resolved.
Show resolved Hide resolved
"matchesForSearchTermfalseone": "{count} bandera",
"matchesForSearchTermfalseother": "{count} banderas",
"noFlagsFound": "Lo siento, no se encontraron banderas que coincidan con su búsqueda",
Expand Down
2 changes: 1 addition & 1 deletion tools/i18next-parser.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {
// Supports JSON (.json) and YAML (.yml) file formats
// Where to write the locale files relative to process.cwd()

pluralSeparator: false,
pluralSeparator: '_',
// Plural separator used in your translation keys
// If you want to use plain english keys, separators such as `_` might conflict. You might want to set `pluralSeparator` to a different string that does not occur in your keys.

Expand Down
Loading