Browse Source

fix(dashboard): Fix i18n refactor errors

Michael Bromley 3 months ago
parent
commit
860f0d5e4e

+ 1 - 1
packages/dashboard/src/app/routes/_authenticated/_administrators/components/role-permissions-display.tsx

@@ -29,7 +29,7 @@ interface RolePermissionsDisplayProps {
 }
 }
 
 
 export function RolePermissionsDisplay({ value = [] }: Readonly<RolePermissionsDisplayProps>) {
 export function RolePermissionsDisplay({ value = [] }: Readonly<RolePermissionsDisplayProps>) {
-    const { t } = useLingui();
+    const { i18n } = useLingui();
     const groupedPermissions = useGroupedPermissions();
     const groupedPermissions = useGroupedPermissions();
 
 
     const { data } = useQuery({
     const { data } = useQuery({

+ 4 - 8
packages/dashboard/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$productOptionGroupId.options_.$id.tsx

@@ -124,11 +124,9 @@ function ProductOptionDetailPage() {
         params: { id: params.id },
         params: { id: params.id },
         onSuccess: async data => {
         onSuccess: async data => {
             toast(
             toast(
-                i18n.t(
-                    creatingNewEntity
-                        ? 'Successfully created product option'
-                        : 'Successfully updated product option',
-                ),
+                creatingNewEntity
+                    ? t`Successfully created product option`
+                    : t`Successfully updated product option`,
             );
             );
             resetForm();
             resetForm();
             const created = Array.isArray(data) ? data[0] : data;
             const created = Array.isArray(data) ? data[0] : data;
@@ -138,9 +136,7 @@ function ProductOptionDetailPage() {
         },
         },
         onError: err => {
         onError: err => {
             toast(
             toast(
-                i18n.t(
-                    creatingNewEntity ? 'Failed to create product option' : 'Failed to update product option',
-                ),
+                creatingNewEntity ? t`Failed to create product option` : t`Failed to update product option`,
                 {
                 {
                     description: err instanceof Error ? err.message : 'Unknown error',
                     description: err instanceof Error ? err.message : 'Unknown error',
                 },
                 },

+ 4 - 10
packages/dashboard/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx

@@ -86,11 +86,9 @@ function ShippingMethodDetailPage() {
         params: { id: params.id },
         params: { id: params.id },
         onSuccess: async data => {
         onSuccess: async data => {
             toast.success(
             toast.success(
-                i18n.t(
-                    creatingNewEntity
-                        ? 'Successfully created shipping method'
-                        : 'Successfully updated shipping method',
-                ),
+                creatingNewEntity
+                    ? t`Successfully created shipping method`
+                    : t`Successfully updated shipping method`,
             );
             );
             resetForm();
             resetForm();
             if (creatingNewEntity) {
             if (creatingNewEntity) {
@@ -99,11 +97,7 @@ function ShippingMethodDetailPage() {
         },
         },
         onError: err => {
         onError: err => {
             toast.error(
             toast.error(
-                i18n.t(
-                    creatingNewEntity
-                        ? 'Failed to create shipping method'
-                        : 'Failed to update shipping method',
-                ),
+                creatingNewEntity ? t`Failed to create shipping method` : t`Failed to update shipping method`,
                 {
                 {
                     description: err instanceof Error ? err.message : 'Unknown error',
                     description: err instanceof Error ? err.message : 'Unknown error',
                 },
                 },