Skip to content

Commit

Permalink
add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-jasinski-cko committed Jan 8, 2025
1 parent 35e5914 commit 5a3013c
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 9 deletions.
2 changes: 1 addition & 1 deletion scripts/modal.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/processout.js

Large diffs are not rendered by default.

30 changes: 24 additions & 6 deletions src/dynamic-checkout/elements/payment-methods-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ module ProcessOut {
public element: HTMLElement;
private expressPaymentMethods: PaymentMethodButton[];
public modal: any;
private paymentConfig: DynamicCheckoutPaymentConfigType;

constructor(expressPaymentMethods: PaymentMethodButton[]) {
constructor(
expressPaymentMethods: PaymentMethodButton[],
paymentConfig: DynamicCheckoutPaymentConfigType
) {
this.expressPaymentMethods = expressPaymentMethods;
this.element = this.createElement();
this.paymentConfig = paymentConfig;
}

private createElement() {
Expand Down Expand Up @@ -44,15 +49,25 @@ module ProcessOut {
footer: true,
stickyFooter: false,
closeMethods: ["overlay", "button", "escape"],
closeLabel: "Close",
closeLabel: Translations.getText(
"payments-manager-close-button",
this.paymentConfig.locale
),
})
: null;

this.modal.setContent(this.createModalContent());

this.modal.addFooterBtn("Close", "close-modal-btn", () => {
this.modal.close();
});
this.modal.addFooterBtn(
Translations.getText(
"payments-manager-close-button",
this.paymentConfig.locale
),
"close-modal-btn",
() => {
this.modal.close();
}
);

this.modal.open();
}
Expand All @@ -67,7 +82,10 @@ module ProcessOut {
{
tagName: "div",
classNames: ["dco-modal-content-header"],
textContent: "Manage saved payment methods",
textContent: Translations.getText(
"payments-manager-header",
this.paymentConfig.locale
),
},
{
tagName: "div",
Expand Down
2 changes: 2 additions & 0 deletions src/dynamic-checkout/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ module ProcessOut {
"city-label": "City",
"postcode-label": "Postal code",
"state-label": "State",
"payments-manager-header": "Manage saved payment methods",
"payments-manager-close-button": "Close",
};
}
2 changes: 2 additions & 0 deletions src/dynamic-checkout/locales/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ module ProcessOut {
"city-label": "Ciudad",
"postcode-label": "Código postal",
"state-label": "Estado",
"payments-manager-header": "Administrar métodos de pago guardados",
"payments-manager-close-button": "Cerrar",
};
}
2 changes: 2 additions & 0 deletions src/dynamic-checkout/locales/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ module ProcessOut {
"city-label": "Ville",
"postcode-label": "Code postal",
"state-label": "État",
"payments-manager-header": "Gérer les méthodes de paiement enregistrées",
"payments-manager-close-button": "Fermer",
};
}
2 changes: 2 additions & 0 deletions src/dynamic-checkout/locales/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ module ProcessOut {
"city-label": "Miasto",
"postcode-label": "Kod pocztowy",
"state-label": "Stan",
"payments-manager-header": "Zarządzaj zapisanymi metodami płatności",
"payments-manager-close-button": "Zamknij",
};
}
2 changes: 2 additions & 0 deletions src/dynamic-checkout/locales/pt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ module ProcessOut {
"city-label": "Cidade",
"postcode-label": "Código postal",
"state-label": "Estado",
"payments-manager-header": "Gerenciar métodos de pagamento salvos",
"payments-manager-close-button": "Fechar",
};
}
3 changes: 2 additions & 1 deletion src/dynamic-checkout/views/payment-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ module ProcessOut {
}

this.paymentMethodsManager = new PaymentMethodsManager(
expressPaymentMethods
expressPaymentMethods,
this.paymentConfig
);

expressCheckoutHeader.appendChild(this.paymentMethodsManager.element);
Expand Down

0 comments on commit 5a3013c

Please sign in to comment.