Skip to content

Instantly share code, notes, and snippets.

@Dahie
Forked from leobossmann/clone shopify checkout locale
Last active December 21, 2015 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Dahie/6304926 to your computer and use it in GitHub Desktop.
Save Dahie/6304926 to your computer and use it in GitHub Desktop.
// When logged in, go to "Settings > Checkout > Checkout Language", click the "View and customize this translation" link.
// A page with a url like this opens: "https://yourshop.myshopify.com/admin/settings/locales/[locale_id]".
// copy [locale_id].
// Go Back and choose "create a new one".
// Open the Javascript console, paste this (change to your shop/locale_id first):
jQuery.get('https://modomoto.myshopify.com/admin/locale_translations.json?locale_id=13212', function(data) {
console.log(data);
transformed_lang = {};
jQuery.each(data.locale_translations, function(i, item){
transformed_lang[item.english] = item.text;
console.log(item.id, item.text);
});
jQuery('label').each(function(i, item){
var string = transformed_lang[jQuery(item).text()],
htmlFor = jQuery(item)[0].htmlFor;
console.log(jQuery('input#'+htmlFor), string);
jQuery('input#'+htmlFor).val(string);
});
});
// Voilà, it's yours to edit. You have to tab through every single one of the fields in order to effectiviely "get" the strings, but that's small work compared to translating all by yourself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment