Go to https://{{your_shopify_domain}}/admin/themes/{{your_theme_code}}/language?category=checkout+%26+system
Open your browser console and paste this code:
var obj = {};
$(".translation__target").each(function() {
var value = this.children[0].value ? this.children[0].value : this.children[0].placeholder
_.set(obj, this.children[0].dataset.key, value);
});
var data = window.URL.createObjectURL(new Blob([JSON.stringify(obj, null, 2)], {type: "application/json;charset=utf-8;"}));
$("<a download='en.system_keys.json'></a>").appendTo($("body")).attr('href', data)[0].click();
Open your browser console and paste this code:
var jsonToMerge = "https://raw.githubusercontent.com/QuintinS/shopcreatify-elivar-eu/master/locales/zh-CN.json"
var mergeData = function(body) {
var obj = {};
var chinese = JSON.parse(body);
var getText = function(key, fallback) {
return (_.get(chinese, key)) ? _.get(chinese, key) : fallback;
};
$(".translation__target").each(function() {
_.set(obj, this.children[0].dataset.key, getText(this.children[0].dataset.key, this.children[0].placeholder));
});
var data = window.URL.createObjectURL(new Blob([JSON.stringify(obj, null, 2)], {type: "application/json;charset=utf-8;"}));
$("<a download='zh-CN.json'></a>").appendTo($("body")).attr('href', data)[0].click()
}
$.get(jsonToMerge, mergeData);
The browser will download your JSON file with Shopify translation keys
@tu5 What you're doing with such a file is to put it in the locales folder of your Shopify theme. It's not supposed to cause any issue if all the keys are filled.
Try the new updated code, it's making sure everything is filled out. And it downloads the json file for you.