SDK Internationalization
Todo Java Script
iOS
Ready-to-use UI currently supports the following languages:
- English (en)
- Arabic (ar)
- Basque (eu-ES)
- Catalan (ca)
- Chinese Simplified (zh-Hans)
- Croatian (hr)
- Czech (cs)
- Danish (da)
- Dutch (nl)
- Dutch Belgium (nl-BE)
- Finnish (fi)
- French (fr-FR)
- French Belgium (fr-BE)
- French Canada (fr-CA)
- Galician (gl-ES)
- German (de)
- German Austria (de-AT)
- Hungarian (hu)
- Italian (it)
- Italian (Switzerland) (it-CH)
- Japanese (ja)
- Korean (ko)
- Norwegian Bokmål (nb)
- Polish (pl)
- Portuguese (pt)
- Romanian (ro)
- Russian (ru)
- Serbian (sr)
- Slovak (sk)
- Slovenian (sl)
- Spanish (es)
- Swedish (sv)
- Thai (th)
Set the Checkout language
By default checkout will use the user’s preferred language, if available. Otherwise English will be used.
You can also set checkout language within OPPCheckoutSettings
configuration (use the two-letter ISO 639-1 standard). Do not set this property to use default language.
OPPCheckoutSettings *settings = [[OPPCheckoutSettings alloc] init];
settings.language = @"de";
let settings = OPPCheckoutSettings()
settings.language = "de"
Change the translation for supported languages
Since version 3.0.0 you can easily change any label of Ready-to-use UI by overriding them in your app.
OPPWAMobile-Resources.bundle
. - Create OPPCheckout.strings file in your project:
- In Xcode, select File > New > File….
- Then select Strings File from the iOS Resource category and click Next.
- Name the file OPPCheckout and click Create.
2. Add new strings which should be changed into this file with the specific keys like in the sample below (base language):
"VIEW_CONTROLLER_TITLE_PAYMENT_METHOD_SELECTION" = "Select Payment Method";
"VIEW_CONTROLLER_TITLE_PAYMENT_DETAILS" = "Payment Details";
"VIEW_CONTROLLER_TITLE_PROCESSING" = "Processing";
See the full list of available keys at the end of this guide.
OPPCheckout.strings
will be created for it. Add translations in the new created file. It’s not required to override all the labels, if you miss something, it will be fetched from the corresponding SDK strings files. NOTE: If you don’t see required language in Localization options, make sure you added the language to the project.
Add a new language
This is pretty much the same as customizing existing strings file for a specific language.
Add missing language for the OPPCheckout.strings file in Localization options and fill it with the all required translations. Note that English strings will be used for the missing keys.
Localization of payment method labels
You can localize label for any payment method you need. Just add a translation with an appropriate key which is concatenation of prefix PAYMENT_METHOD_TYPE_
and brand constant, e.g. MASTER
.
"PAYMENT_METHOD_TYPE_MASTER" = "MasterCard";
"PAYMENT_METHOD_TYPE_AMEX" = "American Express";
Localizable strings
/// View controller titles
"VIEW_CONTROLLER_TITLE_PAYMENT_METHOD_SELECTION" = "Select Payment Method";
"VIEW_CONTROLLER_TITLE_PAYMENT_DETAILS" = "Payment Details";
"VIEW_CONTROLLER_TITLE_PROCESSING" = "Processing";
/// Form titles
"FORM_TITLE_PAYMENT_INFO" = "Payment Info";
/// Labels
"LABEL_TOTAL_AMOUNT" = "Total Amount";
"LABEL_MBWAY_PUSH_NOTIFICATION" = "A push notification will be sent to your device.";
"LABEL_MBWAY_ACCEPT_PIN" = "Please accept the transaction with your PIN MB WAY.";
"LABEL_TERMS_AND_CONDITIONS" = "Terms and Conditions";
"LABEL_TERMS_AND_CONDITIONS_AGREEMENT" = "I have read and agree the Terms and Conditions";
"LABEL_SWEDISH" = "Swedish";
"LABEL_FINNISH" = "Finnish";
"LABEL_STC_PAY_SELECT_PAYMENT_METHOD" = "Please select your preferred payment method:";
/// Messages
"MESSAGE_PLEASE_WAIT" = "Please wait";
/// Device owner authentication
"DEVICE_AUTH_REASON" = "To confirm payment";
/// Button titles
"BUTTON_TITLE_PAY" = "Pay now";
"BUTTON_TITLE_PAY_AMOUNT" = "Pay %@";
"BUTTON_TITLE_REGISTER" = "Register";
"BUTTON_TITLE_CANCEL" = "Cancel";
"BUTTON_TITLE_BACK" = "Change";
"BUTTON_TITLE_DONE" = "Done";
/// Text field label names
"FIELD_LABEL_CARD_HOLDER_NAME" = "Name of Card Holder";
"FIELD_LABEL_CREDIT_CARD_NUMBER" = "Credit Card Number";
"FIELD_LABEL_EXPIRY_DATE" = "Expiration Date";
"FIELD_LABEL_CVV" = "Security Code or CVV";
"FIELD_LABEL_MOBILE_PHONE_NUMBER" = "Mobile Phone Number";
"FIELD_LABEL_QRCODE" = "QR-Code";
"FIELD_LABEL_BANK_ACCOUNT_HOLDER_NAME" = "Account Holder";
"FIELD_LABEL_IBAN" = "IBAN";
"FIELD_LABEL_IBAN_OR_ACCOUNT_NUMBER" = "IBAN or Account Number";
"FIELD_LABEL_BIC_OR_BANK_CODE" = "BIC or Bank Code";
"FIELD_LABEL_SELECT_COUNTRY" = "Select Country:";
"FIELD_LABEL_SELECT_BANK" = "Select Bank:";
"FIELD_LABEL_STORE_PAYMENT_DETAILS" = "Store payment details for future use";
"FIELD_LABEL_STORE_CARD_TYPE" = "Choose card type:";
"FIELD_LABEL_NUMBER_OF_INSTALLMENTS" = "Number of installments";
"FIELD_LABEL_EMAIL" = "Email";
"FIELD_LABEL_COUNTRY_CODE" = "Country code";
"FIELD_LABEL_NATIONAL_IDENTIFIER" = "National Identifier";
"FIELD_LABEL_ACCOUNT_NUMBER" = "Account Number";
"FIELD_LABEL_ACCOUNT_VERIFICATION" = "Account Verification";
/// Text field placeholders
"FIELD_PLACEHOLDER_CARD_HOLDER_NAME" = "Name as it appears on card";
"FIELD_PLACEHOLDER_CARD_NUMBER" = "Long number on the front of your card";
"FIELD_PLACEHOLDER_EXPIRY_DATE" = "MM/YY or MM/YYYY";
"FIELD_PLACEHOLDER_CVV_3_DIGITS" = "3-digit code";
"FIELD_PLACEHOLDER_CVV_4_DIGITS" = "4-digit code";
"FIELD_PLACEHOLDER_BANK_ACCOUNT_HOLDER_NAME" = "Account Holder Name";
"FIELD_PLACEHOLDER_IBAN" = "International Bank Account Number";
"FIELD_PLACEHOLDER_IBAN_OR_ACCOUNT_NUMBER" = "IBAN or Account Number";
"FIELD_PLACEHOLDER_BIC_OR_BANK_CODE" = "BIC or Bank Code";
"FIELD_PLACEHOLDER_COUNTRY_CODE" = "+xxx";
"FIELD_PLACEHOLDER_MOBILE_PHONE_NUMBER" = "xxxxxxxxx";
"FIELD_PLACEHOLDER_EMAIL" = "Email";
"FIELD_PLACEHOLDER_NATIONAL_IDENTIFIER" = "National Identifier";
"FIELD_PLACEHOLDER_ACCOUNT_NUMBER" = "Account Number";
"FIELD_PLACEHOLDER_ACCOUNT_VERIFICATION" = "Account Verification";
/// Text field errors
"FIELD_ERROR_CARD_HOLDER_NAME_INVALID" = "Card holder name is not valid";
"FIELD_ERROR_CARD_NUMBER_INVALID" = "Card number entered is not valid";
"FIELD_ERROR_CARD_EXPIRY_DATE_INVALID" = "Card expiration date is not valid, use MM/YY or MM/YYYY format";
"FIELD_ERROR_CARD_EXPIRED" = "Card is expired";
"FIELD_ERROR_CARD_CVV_3_DIGITS_INVALID" = "Security code must contain last 3 digits on the back of your card";
"FIELD_ERROR_CARD_CVV_4_DIGITS_INVALID" = "Security code must contain 4-digit number on the front of your card";
"FIELD_ERROR_BANK_ACCOUNT_HOLDER_INVALID" = "Account holder name is not valid";
"FIELD_ERROR_IBAN_INVALID" = "IBAN is not valid";
"FIELD_ERROR_IBAN_OR_ACCOUNT_NUMBER_INVALID" = "IBAN or account number is not valid";
"FIELD_ERROR_BIC_OR_BANK_CODE_INVALID" = "BIC or bank code is not valid";
"FIELD_ERROR_EMAIL_INVALID" = "Invalid email";
"FIELD_ERROR_MOBILE_PHONE_INVALID" = "Invalid mobile number";
"FIELD_ERROR_NATIONAL_IDENTIFIER_INVALID" = "Invalid national identifier";
"FIELD_ERROR_ACCOUNT_NUMBER_INVALID" = "Invalid account number";
"FIELD_ERROR_ACCOUNT_EXPIRY_DATE_INVALID" = "Expiration date is not valid, use MM/YY or MM/YYYY format";
"FIELD_ERROR_ACCOUNT_EXPIRED" = "Account is expired";
/// Payment method groups are displayed if tokens are received
"PAYMENT_METHOD_GROUP_STORED" = "Stored Payment Methods";
"PAYMENT_METHOD_GROUP_OTHER" = "Other Payment Methods";
"PAYMENT_METHOD_GROUP_CARDS" = "Credit / Debit Cards";
Note: this section contains the tutorial for Android. A Button to switch between Android and iOS will be implemented at a later time
Android
Ready-to-use UI currently supports the following languages:
- English (en_US)
- Arabic (ar_AR)
- Basque (eu_ES)
- Catalan (ca_ES)
- Chinese Simplified (zh_CN)
- Croatian (hr_HR)
- Czech (cs_CZ)
- Danish (da_DK)
- Dutch (nl_NL)
- Dutch Belgium (nl_BE)
- Finnish (fi_FI)
- French (fr_FR)
- French Belgium (fr_BE)
- French Canada (fr_CA)
- Galician (gl_ES)
- German (de_DE)
- German Austria (de_AT)
- Hungarian (hu_HU)
- Italian (it_IT)
- Italian (Switzerland) (it_CH)
- Japanese (ja_JA)
- Korean (ko_KR)
- Norwegian Bokmål (nb_NO)
- Polish (pl_PL)
- Portuguese (pt_PT)
- Romanian (ro_RO)
- Russian (ru_RU)
- Serbian (sr_RS)
- Slovak (sk_SK)
- Slovenian (sl_SL)
- Spanish (es_ES)
- Swedish (sv_SE)
- Thai (th_TH)
Set the Checkout language
Set up the locale in the CheckoutSettings
and start the CheckoutActivity
. For example:
CheckoutSettings checkoutSettings = new CheckoutSettings(checkoutId, paymentBrands, providerMode);
checkoutSettings.setLocale("de_DE");
Intent intent = checkoutSettings.createCheckoutActivityIntent(this);
startActivityForResult(intent, CheckoutActivity.REQUEST_CODE_CHECKOUT);
val checkoutSettings = CheckoutSettings(checkoutId, paymentParams, providerMode)
checkoutSettings.locale = "de_DE"
intent = checkoutSettings.createCheckoutActivityIntent(this)
startActivityForResult(intent, CheckoutActivity.REQUEST_CODE_CHECKOUT)
Change the translation for supported languages
You can simply override string resources by adding the string with the same key to your app res/values/strings.xml
file.
You will find full list of localizable strings at the end of this guide.
<string name="checkout_transaction_run">Please wait</string>
<string name="checkout_payment_details">Payment Details</string>
<string name="checkout_processing">Processing</string>
....
Add a new language
Add a new language for checkout by creating a new folder for translation values with appropriate locale in /res/
folder. For example see the French language folder: /res/values-fr/
.
Add default strings.xml
there. It can be found in the default folder: /res/values/
Localization of payment method labels
You can localize label for any payment method you need. Just add a translation with an appropriate key which is brand constant in lowercase, e.g. master
.
<string name="master">MasterCard</string>
<string name="amex">American Express</string>
Localizable strings
<!-- content -->
<string name="checkout_transaction_run">Please wait</string>
<string name="checkout_payment_details">Payment Details</string>
<string name="checkout_processing">Processing</string>
<string name="checkout_order_review">Order Review</string>
<string name="checkout_layout_text_payment_info">Payment Info</string>
<string name="checkout_layout_text_total_amount">Total Amount</string>
<string name="checkout_layout_text_select_payment_method">Payment Methods</string>
<string name="checkout_layout_text_stored_payment_methods">Stored Payment Methods</string>
<string name="checkout_layout_text_cards_payment_methods">Credit / Debit Cards</string>
<string name="checkout_layout_text_other_payment_methods">Other Payment Methods</string>
<string name="checkout_layout_text_select_country">Select Country</string>
<string name="checkout_layout_text_select_bank">Select Bank</string>
<string name="checkout_choose_card_type">Choose card type</string>
<string name="checkout_layout_text_pay">PAY NOW</string>
<string name="checkout_layout_text_pay_amount">PAY %s</string>
<string name="checkout_layout_text_register">REGISTER</string>
<string name="checkout_layout_text_header_amount" formatted="false">%.2f %s</string>
<string name="checkout_tokenization_checkbox">Store payment details for future use</string>
<string name="checkout_number_of_installments">Number of installments</string>
<string name="checkout_layout_text_push_notification_sent">A push notification will be sent to your device.</string>
<string name="checkout_layout_text_accept_mbway_pin">Please accept the transaction with your PIN MB WAY.</string>
<string name="checkout_layout_text_terms_and_conditions">Terms and Conditions</string>
<string name="checkout_layout_text_terms_and_conditions_agreement">I have read and agree the Terms and Conditions</string>
<string name="checkout_layout_text_swedish">Swedish</string>
<string name="checkout_layout_text_finnish">Finnish</string>
<string name="checkout_layout_text_pay_with">Pay with</string>
<string name="checkout_layout_text_ship_to">Ship to</string>
<string name="checkout_layout_text_order_summary">Order summary</string>
<string name="checkout_layout_text_order_total">TOTAL</string>
<!-- hints -->
<string name="checkout_layout_hint_card_holder">Name of Card Holder</string>
<string name="checkout_layout_hint_card_number">Credit Card Number</string>
<string name="checkout_layout_hint_card_expiration_date">Expiration Date</string>
<string name="checkout_layout_hint_card_cvv">Security Code or CVV</string>
<string name="checkout_layout_hint_phone_number">Mobile Phone Number</string>
<string name="checkout_layout_hint_direct_debit_sepa_account_holder">Account Holder</string>
<string name="checkout_layout_hint_direct_debit_sepa_iban">IBAN</string>
<string name="checkout_layout_hint_email">Email</string>
<string name="checkout_layout_hint_country_code">Country Code</string>
<string name="checkout_layout_hint_national_identifier">National Identifier</string>
<string name="checkout_layout_hint_account_number">Account Number</string>
<string name="checkout_layout_hint_account_verification">Account Verification</string>
<!-- helpers -->
<string name="checkout_helper_card_holder">Name as it appears on card</string>
<string name="checkout_helper_card_number">Long number on the front of your card</string>
<string name="checkout_helper_expiration_date">Use MM/YY or MM/YYYY format</string>
<string name="checkout_helper_security_code">Last 3 digits on the back of your card</string>
<string name="checkout_helper_security_code_amex">4-digit code on front of your card</string>
<string name="checkout_helper_country_code">+xxx</string>
<string name="checkout_helper_phone_number">xxxxxxxxx</string>
<string name="checkout_helper_iban">The IBAN (International Bank Account Number) associated with the bank account</string>
<string name="checkout_helper_iban_account_number">IBAN or Account Number</string>
<string name="checkout_helper_bic_bank_code">BIC or Bank Code</string>
<string name="checkout_helper_national_identifier">National Identifier</string>
<string name="checkout_helper_account_number">Account Number</string>
<string name="checkout_helper_account_verification">Account Verification</string>
<!-- errors -->
<string name="checkout_error_card_holder_invalid">Card holder name is not valid</string>
<string name="checkout_error_card_number_invalid">Card number entered is not valid</string>
<string name="checkout_error_expiration_date_invalid">Card expiration date is not valid, use MM/YY or MM/YYYY format</string>
<string name="checkout_error_expiration_date">Card is expired</string>
<string name="checkout_error_security_code_invalid">Security code must contain last 3 digits on the back of your card</string>
<string name="checkout_error_security_code_invalid_amex">Security code must contain 4-digit number on the front of your card</string>
<string name="checkout_error_mobile_phone_number_invalid">Invalid mobile number</string>
<string name="checkout_error_account_holder_invalid">Account holder name is not valid</string>
<string name="checkout_error_iban_invalid">IBAN is not valid</string>
<string name="checkout_error_iban_account_number_invalid">IBAN or Account Number is not valid</string>
<string name="checkout_error_bic_bank_code_invalid">BIC or Bank Code is not valid</string>
<string name="checkout_error_email_invalid">Invalid email</string>
<string name="checkout_error_national_identifier_invalid">Invalid national identifier</string>
<string name="checkout_error_account_number_invalid">Invalid account number</string>
<string name="checkout_error_account_expiration_date_invalid">Expiration date is not valid, use MM/YY or MM/YYYY format</string>
<string name="checkout_error_account_expired">Account is expired</string>
<!-- device auth -->
<string name="checkout_auth_confirm_payment">To confirm payment</string>
<string name="checkout_fingerprint_touch_sensor">Touch sensor</string>
<string name="checkout_fingerprint_success">Fingerprint recognized</string>
<string name="checkout_fingerprint_not_recognized">Fingerprint not recognized, try again</string>
<string name="checkout_fingerprint_enter_pin">Enter PIN</string>
<string name="checkout_fingerprint_cancel">Cancel</string>