Is anybody using the Angular localization / i18n system with Capacitor? If so, can you share how you handle the fact that Capacitor gets uncomfortable with the notion that one project does not necessarily build down to a single www
object code tree with an index.html
at top-level?
The most closely-related discussion I could find is #691 involving multiple apps in a monorepo, and I’m not yet sure how relevant I really think it is.
Things I can think to do so far:
- manually intervene in the build process to hoist a particular language’s build up to top level temporarily, run
npx cap copy
, then stuff the localized build back down into its locale directory; - add a CLI argument to cap (like
locale
) that effectively gives cap an “active” subdirectory underwww
that it should treat the way it treatswww
itself currently; - try to figure out a way to munge about in
angular.json
in order to ask Angular to put a particular language at top level; - cry in beer
To replicate the problem, simply follow the Angular localization documentation and build with localize
set to true. Instead of having all the project object code be under www
, you should see it under www/fr
(or whatever language you chose). Then run npx cap copy
and you should be greeted with:
[error] The web directory (/path/to/project/www) must contain a "index.html".
It will be the entry point for the web portion of the Capacitor app.
Look a little deeper, my friend. index.html
is just one directory down, in www/ja
.