Skip to content

Commit

Permalink
feat: Add support for additional languages in i18n
Browse files Browse the repository at this point in the history
This commit adds support for the following languages in the i18n module:
- Polish (pl)
- Vietnamese (vi)
- Tagalog (tl)
- Somali (so)
- Amharic (am)
  • Loading branch information
Ahmedhossamdev committed Oct 23, 2024
1 parent 4227fd5 commit 9276155
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lib/i18n.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import { init, register, getLocaleFromNavigator } from 'svelte-i18n';

register('en', () => import('./../locales/en.json'));
register('es', () => import('./../locales/es.json'));

register('en', () => import('./../locales/en.json')); // English
register('es', () => import('./../locales/es.json')); // Spanish
register('pl', () => import('./../locales/pl.json')); // Polish
register('vi', () => import('./../locales/vi.json')); // Vietnamese
register('tl', () => import('./../locales/tl.json')); // Tagalog
register('so', () => import('./../locales/so.json')); // Somali
register('am', () => import('./../locales/am.json')); // Amharic

const locale = getLocaleFromNavigator();

const lang = locale ? locale.split('-')[0] : 'en';

console.log(lang)

init({
fallbackLocale: 'en',
initialLocale: lang
Expand Down
29 changes: 29 additions & 0 deletions src/locales/am.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"search": {
"placeholder": "ቆሻሻዎችን፣ መንገዶችን እና ቦታዎችን ይፈልጉ",
"results_for": "የፍለጋ ውጤቶች ለ",
"clear_results": "ውጤቶችን አጥፋ",
"search": "ፈልግ"
},
"header": {
"home": "ቤት",
"about": "ስለ እኛ",
"contact": "እኛን ያነጋግሩ",
"fares_and_tolls": "ክፍያዎች እና ግብሶች"
},
"status": {
"scheduled": "ታቅዷል",
"early": "በስተ ቀድሞ",
"late": "ዝንባሌ",
"on_time": "በትክክል ጊዜ",
"min": "ደቂቃ",
"arrives_on_time": "በጊዜው ይደርሳል",
"scheduled_not_real_time": "ታቅዷል/እንደሚሆነ ሁኔታ"
},
"arrivals_and_departures": "መግቢያዎችና መውጫዎች",
"stop": "ቆሻሻ",
"routes": "መንገዶች",
"route": "መንገድ",
"loading": "በመጫን ላይ",
"arrives": "ይደርሳል"
}
29 changes: 29 additions & 0 deletions src/locales/pl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"search": {
"placeholder": "Szukaj przystanków, tras i miejsc",
"results_for": "Wyniki wyszukiwania dla",
"clear_results": "Wyczyść wyniki",
"search": "Szukaj"
},
"header": {
"home": "Strona główna",
"about": "O nas",
"contact": "Kontakt",
"fares_and_tolls": "Opłaty i myta"
},
"status": {
"scheduled": "zaplanowany",
"early": "wcześnie",
"late": "spóźniony",
"on_time": "na czas",
"min": "min",
"arrives_on_time": "przyjeżdża na czas",
"scheduled_not_real_time": "Zaplanowane/nie w czasie rzeczywistym"
},
"arrivals_and_departures": "Przyjazdy i odjazdy",
"stop": "Przystanek",
"routes": "Trasy",
"route": "trasa",
"loading": "Ładowanie",
"arrives": "przyjeżdża"
}
29 changes: 29 additions & 0 deletions src/locales/so.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"search": {
"placeholder": "Raadi joogsiyo, wadooyin iyo meelo",
"results_for": "Natiijooyinka raadinta ee",
"clear_results": "Nadiifi natiijooyinka",
"search": "Raadi"
},
"header": {
"home": "Bogga Hore",
"about": "Nagu saabsan",
"contact": "Nala soo xiriir",
"fares_and_tolls": "Lacagta iyo cashuuraha"
},
"status": {
"scheduled": "jadwaleysan",
"early": "goor hore",
"late": "daahsan",
"on_time": "wakhtiga",
"min": "daqiiqo",
"arrives_on_time": "wakhtiga ku yimid",
"scheduled_not_real_time": "Jadwaleysan/maaha waqtiga dhabta ah"
},
"arrivals_and_departures": "Imaatinka iyo baxsashada",
"stop": "Joogsi",
"routes": "Wadooyin",
"route": "waddo",
"loading": "Shaqeynaya",
"arrives": "imaataa"
}
29 changes: 29 additions & 0 deletions src/locales/tl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"search": {
"placeholder": "Maghanap ng mga hintuan, ruta, at lugar",
"results_for": "Mga resulta ng paghahanap para sa",
"clear_results": "I-clear ang mga resulta",
"search": "Maghanap"
},
"header": {
"home": "Home",
"about": "Tungkol sa amin",
"contact": "Makipag-ugnayan",
"fares_and_tolls": "Pamasahe at mga buwis"
},
"status": {
"scheduled": "naka-iskedyul",
"early": "maaga",
"late": "huli",
"on_time": "oras",
"min": "minuto",
"arrives_on_time": "dumarating ng oras",
"scheduled_not_real_time": "Naka-iskedyul/hindi real-time"
},
"arrivals_and_departures": "Mga pagdating at pag-alis",
"stop": "Hintuan",
"routes": "Mga ruta",
"route": "ruta",
"loading": "Naglo-load",
"arrives": "dumarating"
}
29 changes: 29 additions & 0 deletions src/locales/vi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"search": {
"placeholder": "Tìm kiếm trạm dừng, tuyến đường và địa điểm",
"results_for": "Kết quả tìm kiếm cho",
"clear_results": "Xóa kết quả",
"search": "Tìm kiếm"
},
"header": {
"home": "Trang chủ",
"about": "Về chúng tôi",
"contact": "Liên hệ",
"fares_and_tolls": "Phí và lệ phí"
},
"status": {
"scheduled": "đã lên lịch",
"early": "sớm",
"late": "trễ",
"on_time": "đúng giờ",
"min": "phút",
"arrives_on_time": "đến đúng giờ",
"scheduled_not_real_time": "Lên lịch/không thời gian thực"
},
"arrivals_and_departures": "Đến và đi",
"stop": "Trạm dừng",
"routes": "Tuyến đường",
"route": "tuyến đường",
"loading": "Đang tải",
"arrives": "đến"
}

0 comments on commit 9276155

Please sign in to comment.