Is there a way in which a web manifest can be localised? i.e. having multiple translations of name
, description
etc...
I have thought of a couple of potential solutions but they each have pretty big drawbacks...
Potential Solution 1 (preferred but not sure if it will work)
Dependant on the locale in the url (example.com/en/foo
), load the relative manifest.
For example:
- For
example.com/en/foo
, loadexample.com/en/manifest.json
- For
example.com/jp/foo
, loadexample.com/jp/manifest.json
Drawbacks
- I don't believe this will actually work as there can only be one manifest per website (as far as I am aware), and I am fairly certain it needs to be in the root
- Even if this is possible, given my application is a statically hosted SPA, I am not entirely sure how I would go about implementing it i.e. I can't dynamically update the link to the manifest before the manifest is loaded by the browser. Maybe I can load the manifest relative to the URI but not 100% sure this will work
Potential Solution 2
Host multiple versions of the PWA (either subdomain or TLD)... For example:
en.example.com
/example.com
jp.example.com
/example.jp
- etc...
Given the manifest is generated by the build process, this would actually be very easy to implement by adding multiple deploy steps to the pipelines. I would then use the environment variables for each deployment to determine the text to be inserted into the manifest.
Drawbacks
- Switching language of the app is not possible (this is a pretty key feature for the client)
- Regardless of how 'easy' it is to implement, it simply doesn't seem right