How to Localize / Internationalize Workers Site Pages

Hi all.

PHP provides a easy possiblity to localize / internationalise Website Pages
by installing on the server a simple library that includes json array files for mostly used words and can be included inside the code or is always dynamic already loaded
to serve and print out a localized Webpage based on the GeoIP of the Visitor.

My Question is how can the same be achieved with CloudFlare Workers ?
Does Cloudflare Workers provides also a easy possibility to localize and serve a Cloudflare Worker Website Page to a visitor by setting the langue to let say german or something ?

it would be great if it could be extended for keywords that are not widly used
but for the specific webpage can be added and saved and loaded automaticly.

Thanks in advance for your Replys.

Workers site isn’t dynamic as with PHP, it’s static.

You’d need to make multiple versions of your site and serve from different folders, one for each language.

1 Like

Hi Thomas.

Thank you very much for your Reply.

It is really sad that Cloudflare does not provide an easy possibility
for localization / internationalization / globalization of workers.

From what it looks like for each possible Language
it has to be created a own static webpage and be stored inside the KV Database to be fetched on a request.

This is bad becouse when you have 10’000 Pages for a Website and you need to localize this pages
into 100 language versions that will be 1’000’000 Pages.

And then when you need to change something on the page let say insert a new Naviagtion Link
then this all 1’000’000 Pages need to be modifyed.

This is a big Joke.
Cloudflare can and need do better.

There exist allready a lot of JSON Array Librarys that can be loaded
on each POP so each worker can access then this JSON Array localization librarys direct from inside the Worker and by this then providing a easy possibility to localize / internationalize / globalize Workers running on the POPs.

Having something like this to be accessed from inside of the Workers on each POP would be really helpfull !

Why are such JSON Array Language Files not availble on each POP to be access from Workers ?
We need something like this for easy and fast translation of our Workers !!!

Worker Sites is an out-of-the-box solution, you’re free to build a template solution for it using the source code located here:

For example, attach the HTMLRewriter and you can do streaming re-writes:

Why doesn’t solutions already exist?
Cloudflare provides the tools for it, but the community has to build it for their use-cases.

Hi Thomas.

Thank you very much again for your Helpfull Tips.

The problem with Translation / Localization / Globalization of Workers is still not solved.

Having HTMLRewrite does not help in setting the needed Locale for the Visitor.
What is needed is a native possiblity for workers to set the locale like


and be able to ouput the localized / translated /globalized version.

This locales are not availble from inside the Workers.

Also this HTMLRewrite approach is not Serverless if you need to deal itself with
Translation Language Catalogs that should exist already on the POP Server itself !!!

Cloudflare has allready such a possiblity but it is needed for workers to be availbe too !!!

  <Trans>Hmm... We couldn't find any matching websites.</Trans>

Why are this translation language and localization catalogs not availble for the Workers too ?
For a Serverless environment dont having this tralation and localization catalogs to be not availble and be accessed from the Workers is wrong !!!