dist/shopify.i18n.js
function translate(locale) {
    // Check to see if we have the locale translation data available. If not, fetch it via Ajax.
    if(_locales[locale] === undefined) {
      $.getJSON(getLocaleAssetUrl(locale), function (localeData) {
        // Store the returned locale data.
        _locales[locale] = localeData;
        // Try to perform translation again.
        translate(locale);
      });
      return;
    }

    // Translate elements to the given locale.
    $('[data-translate]').each(function(i, element) {
      translateElement(element, locale);
    });

    // Save the chosen locale in a cookie.
    localeCookie.write(locale);
  }
function translate(locale) {
    // Check to see if we have the locale translation data available. If not, fetch it via Ajax.
    if(_locales[locale] === undefined) {
      $.getJSON(getLocaleAssetUrl(locale), function (localeData) {
        // Store the returned locale data.
        _locales[locale] = localeData;
        // Try to perform translation again.
        translate(locale);
      });
      return;
    }

    // Translate elements to the given locale.
    $('[data-translate]').each(function(i, element) {
      translateElement(element, locale);
    });

    // Save the chosen locale in a cookie.
    localeCookie.write(locale);
  }
function translate ( locale ) { // Check to see if we have the locale translation data available. If not, fetch it via Ajax. if ( _locales [ locale ] === undefined ) { $ . getJSON ( getLocaleAssetUrl ( locale ) , function ( localeData ) { // Store the returned locale data. _locales [ locale ] = localeData ; // Try to perform translation again. translate ( locale ) ; } ) ; return ; } // Translate elements to the given locale. $ ( '[data-translate]' ) . each ( function ( i , element ) { translateElement ( element , locale ) ; } ) ; // Save the chosen locale in a cookie. localeCookie . write ( locale ) ; }
Translate all elements on the page marked up with data-translate attributes to the given locale.

@param locale
Translate all elements on the page marked up with data - translate attributes to the given locale .