Skip to content

Commit

Permalink
🐛 fix(i18n): fix pagination i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
thrownullexception committed Jul 3, 2024
1 parent 6232f3e commit 6027a7e
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 55 deletions.
29 changes: 13 additions & 16 deletions src/components/app/table/_Pagination.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import ReactPaginate from "react-paginate";
import { Trans, msg } from "@lingui/macro";
import { ChevronLeft, ChevronRight, MoreHorizontal } from "react-feather";
import { fakeMessageDescriptor } from "translations/fake";
import { TABLE_PAGE_SIZES } from "./constants";
import { Select } from "@/components/ui/select";
import { buttonVariants } from "@/components/ui/button";
Expand Down Expand Up @@ -36,21 +35,19 @@ export function TablePagination({
<div className="px-3 py-2">
<div className="flex items-center flex-col gap-2 md:flex-row md:justify-between">
<div className="flex gap-2 items-center">
<Trans>
Showing
<Select
placeholder={msg`Select Page Size`}
name="table-page-size"
className="w-18"
options={TABLE_PAGE_SIZES.map((option) => ({
value: `${option}`,
label: fakeMessageDescriptor(`${option}`),
}))}
onChange={(value) => setPageSize(Number(value))}
value={`${pageSize}`}
/>{" "}
of <b>{Intl.NumberFormat("en-US").format(totalRecords)}</b> results
</Trans>
<Select
placeholder={msg`Select Page Size`}
name="table-page-size"
className="w-18"
options={TABLE_PAGE_SIZES.map((option) => ({
value: `${option}`,
label: msg`${option} / Page`,
}))}
onChange={(value) => setPageSize(Number(value))}
value={`${pageSize}`}
/>{" "}
/ <b>{Intl.NumberFormat("en-US").format(totalRecords)}</b>{" "}
<Trans> results </Trans>
</div>
<nav role="navigation" aria-label="pagination">
<ReactPaginate
Expand Down
7 changes: 4 additions & 3 deletions src/frontend/views/data/Table/DataTable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { usePaginatedData } from "frontend/lib/data/useApi/usePaginatedData";
import { DEFAULT_PAGINATED_DATA } from "frontend/lib/data/constants/defaults";
import { pluralize } from "shared/lib/strings";
import { msg, t } from "@lingui/macro";
import { msg } from "@lingui/macro";
import { useLingui } from "@lingui/react";
import { useTableState } from "../hooks";
import { IDataTableProps } from "../types";
import { IEmptyWrapperProps } from "@/components/app/empty-wrapper/types";
Expand All @@ -27,7 +28,7 @@ export function BaseDataTable({
}: IProps) {
const [currentState, overridePaginatedDataState, setPaginatedDataState] =
useTableState(stateStorageKey, persistentFilters, defaultTableState);

const { _ } = useLingui();
const tableData = usePaginatedData(dataEndpoint, currentState, {
defaultData: DEFAULT_PAGINATED_DATA,
});
Expand All @@ -46,7 +47,7 @@ export function BaseDataTable({
? // TODO: for contributors: transform this to user readable message
{
text: msg`No result for the current ${pluralize({
singular: t`filter`,
singular: _(msg`filter`),
count: currentState.filters.length,
inclusive: true,
})} applied.`,
Expand Down
9 changes: 6 additions & 3 deletions src/translations/locales/de-de.po
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ msgstr "{0} Auswahl"
msgid "{0} Validations"
msgstr "{0} Validierungen"

msgid "{option} / Page"
msgstr ""

msgid "{plural} Units"
msgstr "{plural} Einheiten"

Expand Down Expand Up @@ -1264,6 +1267,9 @@ msgstr "Wiederherstellen"
msgid "Restored"
msgstr "Restauriert"

msgid "results"
msgstr ""

msgid "Reveal Credentials"
msgstr "Referenzen offenlegen"

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

msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
msgstr ""

msgid "Sign In"
msgstr "Anmelden"

Expand Down
9 changes: 6 additions & 3 deletions src/translations/locales/en-us.po
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ msgstr "{0} Selections"
msgid "{0} Validations"
msgstr "{0} Validations"

msgid "{option} / Page"
msgstr "{option} / Page"

msgid "{plural} Units"
msgstr "{plural} Units"

Expand Down Expand Up @@ -1264,6 +1267,9 @@ msgstr "Restore"
msgid "Restored"
msgstr "Restored"

msgid "results"
msgstr "results"

msgid "Reveal Credentials"
msgstr "Reveal Credentials"

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

msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
msgstr "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"

msgid "Sign In"
msgstr "Sign In"

Expand Down
9 changes: 6 additions & 3 deletions src/translations/locales/es-es.po
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ msgstr "{0} Selecciones"
msgid "{0} Validations"
msgstr "{0} Validaciones"

msgid "{option} / Page"
msgstr ""

msgid "{plural} Units"
msgstr "{plural} Unidades"

Expand Down Expand Up @@ -1264,6 +1267,9 @@ msgstr "Restaurar"
msgid "Restored"
msgstr "Restaurado"

msgid "results"
msgstr ""

msgid "Reveal Credentials"
msgstr "Revelar Credenciales"

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

msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
msgstr ""

msgid "Sign In"
msgstr "Iniciar sesión"

Expand Down
9 changes: 6 additions & 3 deletions src/translations/locales/fr-fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ msgstr "{0} Sélections"
msgid "{0} Validations"
msgstr "{0} Validations"

msgid "{option} / Page"
msgstr ""

msgid "{plural} Units"
msgstr "{plural} Unités"

Expand Down Expand Up @@ -1264,6 +1267,9 @@ msgstr "Restaurer"
msgid "Restored"
msgstr "Restauré"

msgid "results"
msgstr ""

msgid "Reveal Credentials"
msgstr "Révéler les informations d'identification"

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

msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
msgstr ""

msgid "Sign In"
msgstr "Se connecter"

Expand Down
9 changes: 6 additions & 3 deletions src/translations/locales/it-it.po
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ msgstr "{0} Selezioni"
msgid "{0} Validations"
msgstr "{0} Convalide"

msgid "{option} / Page"
msgstr ""

msgid "{plural} Units"
msgstr "{plural} Unità"

Expand Down Expand Up @@ -1264,6 +1267,9 @@ msgstr "Ristabilire"
msgid "Restored"
msgstr "Restaurato"

msgid "results"
msgstr ""

msgid "Reveal Credentials"
msgstr "Rivela credenziali"

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

msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
msgstr ""

msgid "Sign In"
msgstr "Registrazione"

Expand Down
9 changes: 6 additions & 3 deletions src/translations/locales/ja-jp.po
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ msgstr "{0} 個の選択"
msgid "{0} Validations"
msgstr "{0} 検証"

msgid "{option} / Page"
msgstr ""

msgid "{plural} Units"
msgstr "{plural}単位"

Expand Down Expand Up @@ -1264,6 +1267,9 @@ msgstr "復元する"
msgid "Restored"
msgstr "復元されました"

msgid "results"
msgstr ""

msgid "Reveal Credentials"
msgstr "資格情報を明らかにする"

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

msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
msgstr ""

msgid "Sign In"
msgstr "サインイン"

Expand Down
9 changes: 6 additions & 3 deletions src/translations/locales/ko-kr.po
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ msgstr "{0} 선택사항"
msgid "{0} Validations"
msgstr "{0} 유효성 검사"

msgid "{option} / Page"
msgstr ""

msgid "{plural} Units"
msgstr "{plural} 단위"

Expand Down Expand Up @@ -1264,6 +1267,9 @@ msgstr "복원하다"
msgid "Restored"
msgstr "복원됨"

msgid "results"
msgstr ""

msgid "Reveal Credentials"
msgstr "자격 증명 공개"

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

msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
msgstr ""

msgid "Sign In"
msgstr "로그인"

Expand Down
9 changes: 6 additions & 3 deletions src/translations/locales/pseudo.po
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ msgstr ""
msgid "{0} Validations"
msgstr ""

msgid "{option} / Page"
msgstr ""

msgid "{plural} Units"
msgstr ""

Expand Down Expand Up @@ -1264,6 +1267,9 @@ msgstr ""
msgid "Restored"
msgstr ""

msgid "results"
msgstr ""

msgid "Reveal Credentials"
msgstr ""

Expand Down Expand Up @@ -1429,9 +1435,6 @@ msgstr ""
msgid "Show Up In Roles And Permissions"
msgstr ""

msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
msgstr ""

msgid "Sign In"
msgstr ""

Expand Down
9 changes: 6 additions & 3 deletions src/translations/locales/pt-br.po
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ msgstr "{0} Seleções"
msgid "{0} Validations"
msgstr "{0} Validações"

msgid "{option} / Page"
msgstr ""

msgid "{plural} Units"
msgstr "{plural} Unidades"

Expand Down Expand Up @@ -1264,6 +1267,9 @@ msgstr "Restaurar"
msgid "Restored"
msgstr "Restaurado"

msgid "results"
msgstr ""

msgid "Reveal Credentials"
msgstr "Revelar credenciais"

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

msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
msgstr ""

msgid "Sign In"
msgstr "Entrar"

Expand Down
9 changes: 6 additions & 3 deletions src/translations/locales/ru-ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ msgstr "{0} Выбор"
msgid "{0} Validations"
msgstr "{0} Проверки"

msgid "{option} / Page"
msgstr ""

msgid "{plural} Units"
msgstr "{plural} Единицы"

Expand Down Expand Up @@ -1264,6 +1267,9 @@ msgstr "Восстановить"
msgid "Restored"
msgstr "Восстановлен"

msgid "results"
msgstr ""

msgid "Reveal Credentials"
msgstr "Раскрыть учетные данные"

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

msgid "Showing{3, select, placeholder {{0}} name {table-page-size} className {w-18} options {{1}} onChange {{2}}} of <0>{4}</0> results"
msgstr ""

msgid "Sign In"
msgstr "Войти"

Expand Down
Loading

0 comments on commit 6027a7e

Please sign in to comment.