Localization on App Platform

I am looking to migrate existing nginx setup to Digitalocean App Platform. What i have now is and serving english and de version respectively. What is the best way to achieve this in app platform?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello @crashoverride I cant make a frontend router route to different language because those are 2 separate apps. /en/ and /de/ i guess i could somehow make it work to route from one app to another? but im not sure how atm heh

That leaves me with option two. Only problem is how do i prevent App Platform for compiling my code twice? because i use prerendering my compile time is 18 minutes.

I have already created a small script that copies /en/ folder content to /dist/browser. Now i have /dist/browser for english and /dist/browser/de/ for de.

Will try it out tomorrow and let you know.

👋 @brankoilicc

In your follow up comment I see you’re using Angular. Using the Angular Router an app can create routes on the client side directly to the en and de variants. For example, you could detect the language set in the users browser then direct them to the appropriate site with this router module. This is probably the best solution.

Alternatively, you could create an app with two static site components that point to the same git repository. These sites will be the en and de versions. You will need to update the HTTP Route and the Output Directory for both versions. When accessing it will go to the index.html in dist/en and when accessing it will go to the index.html in dist/de.

You could also the root route (/) to one of these so that will show the en or de version based on your preference.

To further clarify we are using angular 11 which compiles two instances of same application /dist/en and /dist/de