How to setup the language?

thierryler
Contributor
Contributor

Hello. Client side, is there a way to setup the language (french, english, etc.) to be used? Maybe with some "lang" attribute...

 

my code is like:

<script src="https://www.paypal.com/sdk/js?client-id={{ ppClientId }}&currency=EUR"></script>

paypal.Buttons({
  style: {
    shape: 'pill',
  },

  createOrder: function(data, actions) {
    return actions.order.create({
      purchase_units: [{
        amount: {
          currency_code: "EUR",
          value: "{{ price }}",
        },
        invoice_id: "{{ invoice.ppInvoiceId }}",
        custom_id: "{{ invoice.ppCustomId }}",
      }],
      {# application_context: {
        shipping_preference: "SET_PROVIDED_ADDRESS", 
      }, #}
      payer: {
        email_address: "{{ email }}",
        name: {
          given_name: "{{ firstname }}",
          surname: "{{ lastname }}",
        },
        {# phone: {
          phone_number: "{{ phone }}"
        }, #}
        address: {
          address_line_1: "{{ streetAddress1 }}",
          address_line_2: "{{ streetAddress2 }}",
          postal_code: "{{ postalCode }}",
          country_code: "{{ countryCode | upper}}",
          admin_area_2: "{{ city | upper}}",
        }
      }
    });
  },
  ...

 

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

MTS_Chiranjeevi
Moderator
Moderator

Good day @thierryler,

 

Thank you for posting to the PayPal community.

 

Yes, you can achieve by passing "locale" attribute.

 

<script src="https://www.paypal.com/sdk/js?client-id=YOUR_CLIENT_ID&locale=fr_FR"></script>

 

Locale: The locale renders components. By default PayPal smartly detects the correct locale for the buyer based on their geolocation and browser preferences. It is recommended to pass this parameter only if you need the PayPal buttons to render in the same languages the rest of your site.


https://developer.paypal.com/sdk/js/configuration/#link-locale

https://developer.paypal.com/api/rest/reference/locale-codes/ 

Sincerely,

Chiranjeevi

PayPal/Braintree MTS

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.

View solution in original post

Login to Me Too
2 REPLIES 2
Solved

MTS_Chiranjeevi
Moderator
Moderator

Good day @thierryler,

 

Thank you for posting to the PayPal community.

 

Yes, you can achieve by passing "locale" attribute.

 

<script src="https://www.paypal.com/sdk/js?client-id=YOUR_CLIENT_ID&locale=fr_FR"></script>

 

Locale: The locale renders components. By default PayPal smartly detects the correct locale for the buyer based on their geolocation and browser preferences. It is recommended to pass this parameter only if you need the PayPal buttons to render in the same languages the rest of your site.


https://developer.paypal.com/sdk/js/configuration/#link-locale

https://developer.paypal.com/api/rest/reference/locale-codes/ 

Sincerely,

Chiranjeevi

PayPal/Braintree MTS

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.

Login to Me Too

bigwetballsack
Contributor
Contributor

I have added "&locale=en_GB" to my script, but the language will not change to english and remains in German

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.