Azure / Azure/static-web-apps

Support for multi language websites that use microformat (eg en-GB , it-IT ) in URL

Open
#721 16 comments 4 reactions 0 assignees View on GitHub
config enhancement
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

It is possible to cleanly support URLs such as

https://www.myawsomeapp.com/en-GB/
https://www.myawsomeapp.com/it-IT/

routes are `angular` routes and we need the fallback to fallback to the countries content.

the file system has a folder for each microformat and each folder has the translated index.html with accompanying translated JavaScript files.

to make it work you would need two fall backs, one for en-GB and one for it-IT.

You can sort of get it to work with the following

```
"routes" : [
{
"route": "/it-IT/search",
"rewrite": "it-IT/index.html"
},
{
"route": "/it-IT/customer",
"rewrite": "it-IT/index.html"
},
{
"route": "/it-IT/about",
"rewrite": "it-IT/index.html"
}
]
```

Where search, customer and about are routes within the app, but for the above you need to repeat this for every language and every route so you soon hit the max file size / max routes for the config.

It would be better if we could do something with fallbacks maybe add `baseref` and have a collection or allow exclude on the route.

eg
```
"navigationFallbacks": [
{
"navigationFallback": {
"baseRef": "en-GB",
"rewrite": "en-GB/index.html",
"exclude": [
"*.css",
"*.js",
"*.ico",
"*.txt",
"*.xml"
]
}
},
{
"navigationFallback": {
"baseRef": "it-IT",
"rewrite": "it-IT/index.html",
"exclude": [
"*.css",
"*.js",
"*.ico",
"*.txt",
"*.xml"
]
}
}
]

```

or allow excludes

```
"routes" : [
{
"route": "/it-IT/*",
"rewrite": "it-IT/index.html",
"exclude": [ "*.{js,css}", "/assets/*"]
}
]
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.