What is the url path for accessing locale files?

Solved

What is the url path for accessing locale files?

kevinsipe
Shopify Partner
4 1 1

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 })

 

Accepted Solution (1)

kevinsipe
Shopify Partner
4 1 1

This is an accepted solution.

Found it.

 

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

View solution in original post

Replies 2 (2)

kevinsipe
Shopify Partner
4 1 1

This is an accepted solution.

Found it.

 

GET /admin/themes/#{theme_id}/assets.json?asset[key]=locales/en.default.json
bloodyalbatross
Shopify Partner
9 0 1

Is there also such an URL for the locale files of extensions?