Skip to content

Commit 6027a7e

Browse files
🐛 fix(i18n): fix pagination i18n
1 parent 6232f3e commit 6027a7e

File tree

14 files changed

+89
-55
lines changed

14 files changed

+89
-55
lines changed

‎src/components/app/table/_Pagination.tsx

+13-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import ReactPaginate from "react-paginate";
22
import { Trans, msg } from "@lingui/macro";
33
import { ChevronLeft, ChevronRight, MoreHorizontal } from "react-feather";
4-
import { fakeMessageDescriptor } from "translations/fake";
54
import { TABLE_PAGE_SIZES } from "./constants";
65
import { Select } from "@/components/ui/select";
76
import { buttonVariants } from "@/components/ui/button";
@@ -36,21 +35,19 @@ export function TablePagination({
3635
<div className="px-3 py-2">
3736
<div className="flex items-center flex-col gap-2 md:flex-row md:justify-between">
3837
<div className="flex gap-2 items-center">
39-
<Trans>
40-
Showing
41-
<Select
42-
placeholder={msg`Select Page Size`}
43-
name="table-page-size"
44-
className="w-18"
45-
options={TABLE_PAGE_SIZES.map((option) => ({
46-
value: `${option}`,
47-
label: fakeMessageDescriptor(`${option}`),
48-
}))}
49-
onChange={(value) => setPageSize(Number(value))}
50-
value={`${pageSize}`}
51-
/>{" "}
52-
of <b>{Intl.NumberFormat("en-US").format(totalRecords)}</b> results
53-
</Trans>
38+
<Select
39+
placeholder={msg`Select Page Size`}
40+
name="table-page-size"
41+
className="w-18"
42+
options={TABLE_PAGE_SIZES.map((option) => ({
43+
value: `${option}`,
44+
label: msg`${option} / Page`,
45+
}))}
46+
onChange={(value) => setPageSize(Number(value))}
47+
value={`${pageSize}`}
48+
/>{" "}
49+
/ <b>{Intl.NumberFormat("en-US").format(totalRecords)}</b>{" "}
50+
<Trans> results </Trans>
5451
</div>
5552
<nav role="navigation" aria-label="pagination">
5653
<ReactPaginate

‎src/frontend/views/data/Table/DataTable/index.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { usePaginatedData } from "frontend/lib/data/useApi/usePaginatedData";
22
import { DEFAULT_PAGINATED_DATA } from "frontend/lib/data/constants/defaults";
33
import { pluralize } from "shared/lib/strings";
4-
import { msg, t } from "@lingui/macro";
4+
import { msg } from "@lingui/macro";
5+
import { useLingui } from "@lingui/react";
56
import { useTableState } from "../hooks";
67
import { IDataTableProps } from "../types";
78
import { IEmptyWrapperProps } from "@/components/app/empty-wrapper/types";
@@ -27,7 +28,7 @@ export function BaseDataTable({
2728
}: IProps) {
2829
const [currentState, overridePaginatedDataState, setPaginatedDataState] =
2930
useTableState(stateStorageKey, persistentFilters, defaultTableState);
30-
31+
const { _ } = useLingui();
3132
const tableData = usePaginatedData(dataEndpoint, currentState, {
3233
defaultData: DEFAULT_PAGINATED_DATA,
3334
});
@@ -46,7 +47,7 @@ export function BaseDataTable({
4647
? // TODO: for contributors: transform this to user readable message
4748
{
4849
text: msg`No result for the current ${pluralize({
49-
singular: t`filter`,
50+
singular: _(msg`filter`),
5051
count: currentState.filters.length,
5152
inclusive: true,
5253
})} applied.`,

‎src/translations/locales/de-de.po

+6-3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ msgstr "{0} Auswahl"
103103
msgid "{0} Validations"
104104
msgstr "{0} Validierungen"
105105

106+
msgid "{option} / Page"
107+
msgstr ""
108+
106109
msgid "{plural} Units"
107110
msgstr "{plural} Einheiten"
108111

@@ -1264,6 +1267,9 @@ msgstr "Wiederherstellen"
12641267
msgid "Restored"
12651268
msgstr "Restauriert"
12661269

1270+
msgid "results"
1271+
msgstr ""
1272+
12671273
msgid "Reveal Credentials"
12681274
msgstr "Referenzen offenlegen"
12691275

@@ -1429,9 +1435,6 @@ msgstr "Vorläufig gelöschte Elemente und die Schaltfläche „Wiederherstellen
14291435
msgid "Show Up In Roles And Permissions"
14301436
msgstr "Erscheinen in Rollen und Berechtigungen"
14311437

1432-
msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
1433-
msgstr ""
1434-
14351438
msgid "Sign In"
14361439
msgstr "Anmelden"
14371440

‎src/translations/locales/en-us.po

+6-3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ msgstr "{0} Selections"
103103
msgid "{0} Validations"
104104
msgstr "{0} Validations"
105105

106+
msgid "{option} / Page"
107+
msgstr "{option} / Page"
108+
106109
msgid "{plural} Units"
107110
msgstr "{plural} Units"
108111

@@ -1264,6 +1267,9 @@ msgstr "Restore"
12641267
msgid "Restored"
12651268
msgstr "Restored"
12661269

1270+
msgid "results"
1271+
msgstr "results"
1272+
12671273
msgid "Reveal Credentials"
12681274
msgstr "Reveal Credentials"
12691275

@@ -1429,9 +1435,6 @@ msgstr "Show Soft Deleted Items And The Restore Button"
14291435
msgid "Show Up In Roles And Permissions"
14301436
msgstr "Show Up In Roles And Permissions"
14311437

1432-
msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
1433-
msgstr "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
1434-
14351438
msgid "Sign In"
14361439
msgstr "Sign In"
14371440

‎src/translations/locales/es-es.po

+6-3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ msgstr "{0} Selecciones"
103103
msgid "{0} Validations"
104104
msgstr "{0} Validaciones"
105105

106+
msgid "{option} / Page"
107+
msgstr ""
108+
106109
msgid "{plural} Units"
107110
msgstr "{plural} Unidades"
108111

@@ -1264,6 +1267,9 @@ msgstr "Restaurar"
12641267
msgid "Restored"
12651268
msgstr "Restaurado"
12661269

1270+
msgid "results"
1271+
msgstr ""
1272+
12671273
msgid "Reveal Credentials"
12681274
msgstr "Revelar Credenciales"
12691275

@@ -1429,9 +1435,6 @@ msgstr "Mostrar elementos eliminados temporalmente y el botón Restaurar"
14291435
msgid "Show Up In Roles And Permissions"
14301436
msgstr "Aparecer en roles y permisos"
14311437

1432-
msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
1433-
msgstr ""
1434-
14351438
msgid "Sign In"
14361439
msgstr "Iniciar sesión"
14371440

‎src/translations/locales/fr-fr.po

+6-3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ msgstr "{0} Sélections"
103103
msgid "{0} Validations"
104104
msgstr "{0} Validations"
105105

106+
msgid "{option} / Page"
107+
msgstr ""
108+
106109
msgid "{plural} Units"
107110
msgstr "{plural} Unités"
108111

@@ -1264,6 +1267,9 @@ msgstr "Restaurer"
12641267
msgid "Restored"
12651268
msgstr "Restauré"
12661269

1270+
msgid "results"
1271+
msgstr ""
1272+
12671273
msgid "Reveal Credentials"
12681274
msgstr "Révéler les informations d'identification"
12691275

@@ -1429,9 +1435,6 @@ msgstr "Afficher les éléments supprimés de manière logicielle et le bouton d
14291435
msgid "Show Up In Roles And Permissions"
14301436
msgstr "Afficher dans les rôles et les autorisations"
14311437

1432-
msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
1433-
msgstr ""
1434-
14351438
msgid "Sign In"
14361439
msgstr "Se connecter"
14371440

‎src/translations/locales/it-it.po

+6-3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ msgstr "{0} Selezioni"
103103
msgid "{0} Validations"
104104
msgstr "{0} Convalide"
105105

106+
msgid "{option} / Page"
107+
msgstr ""
108+
106109
msgid "{plural} Units"
107110
msgstr "{plural} Unità"
108111

@@ -1264,6 +1267,9 @@ msgstr "Ristabilire"
12641267
msgid "Restored"
12651268
msgstr "Restaurato"
12661269

1270+
msgid "results"
1271+
msgstr ""
1272+
12671273
msgid "Reveal Credentials"
12681274
msgstr "Rivela credenziali"
12691275

@@ -1429,9 +1435,6 @@ msgstr "Mostra elementi eliminati temporaneamente e il pulsante Ripristina"
14291435
msgid "Show Up In Roles And Permissions"
14301436
msgstr "Presentarsi in ruoli e autorizzazioni"
14311437

1432-
msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
1433-
msgstr ""
1434-
14351438
msgid "Sign In"
14361439
msgstr "Registrazione"
14371440

‎src/translations/locales/ja-jp.po

+6-3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ msgstr "{0} 個の選択"
103103
msgid "{0} Validations"
104104
msgstr "{0} 検証"
105105

106+
msgid "{option} / Page"
107+
msgstr ""
108+
106109
msgid "{plural} Units"
107110
msgstr "{plural}単位"
108111

@@ -1264,6 +1267,9 @@ msgstr "復元する"
12641267
msgid "Restored"
12651268
msgstr "復元されました"
12661269

1270+
msgid "results"
1271+
msgstr ""
1272+
12671273
msgid "Reveal Credentials"
12681274
msgstr "資格情報を明らかにする"
12691275

@@ -1429,9 +1435,6 @@ msgstr "ソフト的に削除されたアイテムと復元ボタンを表示す
14291435
msgid "Show Up In Roles And Permissions"
14301436
msgstr "役割と権限を表示する"
14311437

1432-
msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
1433-
msgstr ""
1434-
14351438
msgid "Sign In"
14361439
msgstr "サインイン"
14371440

‎src/translations/locales/ko-kr.po

+6-3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ msgstr "{0} 선택사항"
103103
msgid "{0} Validations"
104104
msgstr "{0} 유효성 검사"
105105

106+
msgid "{option} / Page"
107+
msgstr ""
108+
106109
msgid "{plural} Units"
107110
msgstr "{plural} 단위"
108111

@@ -1264,6 +1267,9 @@ msgstr "복원하다"
12641267
msgid "Restored"
12651268
msgstr "복원됨"
12661269

1270+
msgid "results"
1271+
msgstr ""
1272+
12671273
msgid "Reveal Credentials"
12681274
msgstr "자격 증명 공개"
12691275

@@ -1429,9 +1435,6 @@ msgstr "소프트 삭제된 항목 및 복원 버튼 표시"
14291435
msgid "Show Up In Roles And Permissions"
14301436
msgstr "역할 및 권한에 표시"
14311437

1432-
msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
1433-
msgstr ""
1434-
14351438
msgid "Sign In"
14361439
msgstr "로그인"
14371440

‎src/translations/locales/pseudo.po

+6-3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ msgstr ""
103103
msgid "{0} Validations"
104104
msgstr ""
105105

106+
msgid "{option} / Page"
107+
msgstr ""
108+
106109
msgid "{plural} Units"
107110
msgstr ""
108111

@@ -1264,6 +1267,9 @@ msgstr ""
12641267
msgid "Restored"
12651268
msgstr ""
12661269

1270+
msgid "results"
1271+
msgstr ""
1272+
12671273
msgid "Reveal Credentials"
12681274
msgstr ""
12691275

@@ -1429,9 +1435,6 @@ msgstr ""
14291435
msgid "Show Up In Roles And Permissions"
14301436
msgstr ""
14311437

1432-
msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
1433-
msgstr ""
1434-
14351438
msgid "Sign In"
14361439
msgstr ""
14371440

‎src/translations/locales/pt-br.po

+6-3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ msgstr "{0} Seleções"
103103
msgid "{0} Validations"
104104
msgstr "{0} Validações"
105105

106+
msgid "{option} / Page"
107+
msgstr ""
108+
106109
msgid "{plural} Units"
107110
msgstr "{plural} Unidades"
108111

@@ -1264,6 +1267,9 @@ msgstr "Restaurar"
12641267
msgid "Restored"
12651268
msgstr "Restaurado"
12661269

1270+
msgid "results"
1271+
msgstr ""
1272+
12671273
msgid "Reveal Credentials"
12681274
msgstr "Revelar credenciais"
12691275

@@ -1429,9 +1435,6 @@ msgstr "Mostrar itens excluídos de forma reversível e o botão Restaurar"
14291435
msgid "Show Up In Roles And Permissions"
14301436
msgstr "Apareça em funções e permissões"
14311437

1432-
msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
1433-
msgstr ""
1434-
14351438
msgid "Sign In"
14361439
msgstr "Entrar"
14371440

‎src/translations/locales/ru-ru.po

+6-3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ msgstr "{0} Выбор"
103103
msgid "{0} Validations"
104104
msgstr "{0} Проверки"
105105

106+
msgid "{option} / Page"
107+
msgstr ""
108+
106109
msgid "{plural} Units"
107110
msgstr "{plural} Единицы"
108111

@@ -1264,6 +1267,9 @@ msgstr "Восстановить"
12641267
msgid "Restored"
12651268
msgstr "Восстановлен"
12661269

1270+
msgid "results"
1271+
msgstr ""
1272+
12671273
msgid "Reveal Credentials"
12681274
msgstr "Раскрыть учетные данные"
12691275

@@ -1429,9 +1435,6 @@ msgstr "Показать обратимо удаленные элементы и
14291435
msgid "Show Up In Roles And Permissions"
14301436
msgstr "Показывать роли и разрешения"
14311437

1432-
msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
1433-
msgstr ""
1434-
14351438
msgid "Sign In"
14361439
msgstr "Войти"
14371440

0 commit comments

Comments
 (0)