The site I'm building currently has three different regional versions (Australia, Germany, rest-of-world). These will be deployed to seperate urls.

It's a static site, hosted on s3 using react. The three versions share 99% of the code and use the same assests (images, video) but have different text and possibly an extra page.

How do I manage this? I want 99% of the changes I make to be shared by all of the regions.

Here are the thoughts I had:

  1. Determine locale at runtime, letting the React components handle the differences
    • pros: conceptually simple, only build once
    • cons: everyone gets everything
  2. Determine locale at build time by setting environmental variables
    • pros: users only download what is needed
    • cons: complexity
  3. Three different repos, two of which freqeuently fetch from a "master" repo
    • pros: ??
    • cons: guaranteed to forget to sync at some point

I'm leaning towards option 1. The issue of sending the user way too much data could be solved by using code splitting.


The way I've always seen it done it to determine the local via the url or ip and generate the page with the correct assets on the server (caching to CDN as appropriate)

However, as you have a static site you obviously cant do this without adding server side scripting of some kind.

I guess the equivalent option would be to generate a version per local and deploy each to an appropriate url.

Rather than store them all in separate source control repos though, maybe you could use some of these new fancy static site generators to generate all the versions from a single source?

Although frankly, if you use a CDN already I don't think you'll see any advantage over traditional server side scripting as your content will be being served statically from the CDN in either case.

In Summary, my advice would be to add minimal server side scripting for the routing of traffic to the correct version of the site and the generating of the page with the correct text resource.

Essentially this combines the best of option 1 and 2 by giving you an extra bit of run-time on the server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.