Skip to content

Commit ae919e9

Browse files
author
Laegel
authored
fix/language-fallback (tauri-apps#110)
* fix: Attempt to apply redirect with regex * fix: Trying with country & wildcard * fix: Language dropdown & redirect * fix: Addded country mapping to redirects * fix: zh-hans instead of zh-hant
1 parent 8fd318a commit ae919e9

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

netlify.toml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,38 @@
22
publish = "build"
33
command = "node build"
44

5-
[[redirects]]
6-
from = "/"
7-
to = "/en"
8-
status = 301
5+
# [[redirects]]
6+
# from = "/*"
7+
# to = "/pt-br/:splat"
8+
# status = 302
9+
# conditions = {Country = ["BR"]}
910

1011
# [[redirects]]
11-
# from = "/en"
12-
# to = "/"
13-
# status = 301
12+
# from = "/*"
13+
# to = "/zh-hans/:splat"
14+
# status = 302
15+
# conditions = {Country = ["CN"]}
1416

1517
# [[redirects]]
16-
# from = "/en/*"
17-
# to = "/"
18-
# status = 301
18+
# from = "/*"
19+
# to = "/zh-hant/:splat"
20+
# status = 302
21+
# conditions = {Country = ["HK", "TW"]}
22+
23+
# [[redirects]]
24+
# from = "/*"
25+
# to = "/ru/:splat"
26+
# status = 302
27+
# conditions = {Country = ["RU"]}
28+
29+
# [[redirects]]
30+
# from = "/*"
31+
# to = "/fr/:splat"
32+
# status = 302
33+
# conditions = {Country = ["FR"]}
34+
35+
[[redirects]]
36+
from = "/*"
37+
to = "/en/:splat"
38+
status = 301
39+

src/theme/Navbar/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ function Navbar() {
157157
{languages[language]}
158158
</button>
159159
<ul class="dropdown__menu">
160-
{enabledLanguages.length > 1 ? (
160+
{enabledLanguages.length ? (
161161
enabledLanguages.map(([key, label]) => (
162162
<li>
163163
<a

supported-languages.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Supported languages
2+
// Note that you'll need to modify netlify.toml to enable redirects!
3+
14
module.exports = {
25
en: 'English',
36
// fr: 'Français',

0 commit comments

Comments
 (0)