Using Giftship in Multiple Languages

Giftship can be used on a single Shopify storefront in multiple languages. In order to do so, the first step is to translate Giftship into the language of your choice by navigating to Shopify Admin -> Apps -> Giftship -> Language, and selecting the language you would like to edit from the dropdown menu.

The available languages in this dropdown are read from your themes locale files, so if you do not see the language you would like to use, please add a locale file to your published theme.

Translate each of the words or phrases to the selected language, then click the save button.

Repeat the above step for every language you would like to support.

Now that you have your translations configured, you will need to ensure that these are used throughout the application, based on your language picker settings. This may vary depending on your translation integration, but the general idea is as follows

When a language other than your default language is used, set a cookie with javascript, with the name “gs_locale”, and a value of the 2 letter country code according to your locale files.

The following code is an example of how this can be accomplished:

//Function to set a cookie with javascript
function createCookie(name, value, days) {
  var expires = "";
  if (days) {
    var date = new Date();
    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
    expires = "; expires=" + date.toUTCString();
  }
  document.cookie = name + "=" + value + expires + "; path=/";
}

// This would be the element of your language picker
var languagePickerElement = document.querySelector('.ice-cream');

// When the language picker dropdown changes, trigger the createCookie function
languagePickerElement.addEventListener('change', (event) => {
  createCookie("gs_locale", "fr", 7);
});

Can't find the answer in our documentation?
Contact Support