What is the url path for accessing locale files?

Solved
Highlighted
Shopify Partner
4 1 0

I am having trouble implementing Asoul's custom client-side translation solution found here. The problem seems to be that the langPackUrl is incorrect. The url generated is something like "//cdn.shopify.com/s/files/1/0001/0002/0003/t/7/assets/locales.en.json?10850557867587876845". Are the locale json files located in the assets folder? Something is wrong here.

 

let langPackUrl = '{{ "locales..json" | asset_url }}'.replace('s..j', 's.' + lang + '.j')

$.ajax({ url: langPackUrl, type: 'GET', dataType: 'json', async: false })

 

0 Likes

Success.

Shopify Partner
4 1 0

Found it.

 

GET /admin/themes/#{theme_id}/assets.json?asset[key]=locales/en.default.json
0 Likes