Add Arabic language to dropdown, fix header locale not working

This commit is contained in:
montylion
2021-08-23 16:35:28 +02:00
parent 34ae2da516
commit ee83ca7067
4 changed files with 17 additions and 7 deletions

1
package-lock.json generated
View File

@@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
"name": "website",
"version": "1.0.0",
"license": "ISC",
"dependencies": {

View File

@@ -29,19 +29,24 @@ app.use(cookieParser())
// Locale express middleware setup
app.use(expressLocale({
"priority": ["cookie", "map", "accept-language", "default"],
"priority": ['cookie', 'accept-language', 'map', 'default'],
cookie: {name: 'preferredLocale'},
// fallbacks for browsers that don't send a region code, but only a language
map: {
//de: 'de-DE',
ar: 'ar-AR',
es: 'es-ES',
//fr: 'fr-FR',
it: 'it-IT',
ko: 'ko-KR',
ru: 'ru-RU',
tr: 'tr-TR'
},
allowed: ['en-US', 'es-ES', 'it-IT', 'ko-KR', 'ru-RU', 'tr-TR'],
allowed: [
'en-US', // English doesn't need as many allowed locales since it's the default anyways
'ar', 'ar-AR',
'es', 'es-ES',
'it', 'it-IT',
'ru', 'ru-RU',
'tr', 'tr-TR',
],
"default": "en-US"
}))

View File

@@ -39,14 +39,12 @@
<div class="item"><span class="lang">🇺🇸</span><span class="locale-names">English</span></div>
</label>
</div>
<div class="option">
<input type="radio" class="radio" id="es-ES" name="category" />
<label for="es-ES">
<div class="item"><span class="lang">🇪🇸</span><span class="locale-names">Español</span></div>
</label>
</div>
<div class="option">
<input type="radio" class="radio" id="it-IT" name="category" />
<label for="it-IT">
@@ -65,6 +63,12 @@
<div class="item"><span class="lang">🇹🇷</span><span class="locale-names">Türkçe</span></div>
</label>
</div>
<div class="option">
<input type="radio" class="radio" id="ar-AR" name="category" />
<label for="ar-AR">
<div class="item"><span class="lang">🇸🇦</span><span class="locale-names">اَلْعَرَبِيَّةُ</span></div>
</label>
</div>
</div>
<div class="selected-locale">
<div class="item"><span class="lang"></span></div>