Skip to content

Commit

Permalink
feat: add new languages and update dropdown styling (casbin#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
HashCookie authored Jul 20, 2024
1 parent 100d89e commit 4e59fb9
Show file tree
Hide file tree
Showing 13 changed files with 176 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/components/LanguageMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ const LanguageMenu = () => {
ja: '日本語',
fr: 'Français',
de: 'Deutsch',
es: 'Español',
id: 'Indonesia',
ko: '한국어',
ru: 'Русский',
vi: 'Việt Nam',
pt: 'Português',
it: 'Italiano',
ms: 'Malay',
tr: 'Turkish',
ar: 'العربية',
};

const handleLangChange = (newLang) => {
Expand Down Expand Up @@ -59,7 +69,7 @@ const LanguageMenu = () => {
{currentLanguage}
</button>
</DropdownMenu.Trigger>
<DropdownMenu.Content sideOffset={5} className="bg-white rounded-md p-2 z-10">
<DropdownMenu.Content sideOffset={5} className="bg-white rounded-md p-2 z-10 dropdown-content">
{Object.keys(languageNames).map((code) => {
return (
<DropdownMenu.Item
Expand Down
10 changes: 10 additions & 0 deletions app/context/LangContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ const translations = {
ja: require('../../messages/ja.json'),
fr: require('../../messages/fr.json'),
de: require('../../messages/de.json'),
es: require('../../messages/es.json'),
id: require('../../messages/id.json'),
ko: require('../../messages/ko.json'),
ru: require('../../messages/ru.json'),
vi: require('../../messages/vi.json'),
pt: require('../../messages/pt.json'),
it: require('../../messages/it.json'),
ms: require('../../messages/ms.json'),
tr: require('../../messages/tr.json'),
ar: require('../../messages/ar.json'),
};

type LangContextType = {
Expand Down
5 changes: 5 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@
button:hover img {
filter: brightness(0) invert(1);
}

.dropdown-content {
max-height: var(--radix-dropdown-menu-content-available-height);
overflow-y: auto;
}
15 changes: 15 additions & 0 deletions messages/ar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Custom config": "تكوين مخصص",
"Model": "نموذج",
"Select your model": "حدد النموذج الخاص بك",
"RESET": "إعادة ضبط",
"Policy": "سياسة",
"Request": "طلب",
"Enforcement Result": "نتيجة التنفيذ",
"Why this result": "لماذا هذه النتيجة",
"SYNTAX VALIDATE": "التحقق من بناء الجملة",
"RUN THE TEST": "تشغيل الاختبار",
"SHARE": "مشاركة",
"Copied": "تم النسخ",
"COPY": "نسخ"
}
15 changes: 15 additions & 0 deletions messages/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Custom config": "Configuración personalizada",
"Model": "Modelo",
"Select your model": "Seleccione su modelo",
"RESET": "REINICIAR",
"Policy": "Política",
"Request": "Solicitud",
"Enforcement Result": "Resultado de ejecución",
"Why this result": "Por qué este resultado",
"SYNTAX VALIDATE": "VALIDAR SINTAXIS",
"RUN THE TEST": "EJECUTAR PRUEBA",
"SHARE": "COMPARTIR",
"Copied": "Copiado",
"COPY": "COPIAR"
}
15 changes: 15 additions & 0 deletions messages/id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Custom config": "Konfigurasi khusus",
"Model": "Model",
"Select your model": "Pilih model Anda",
"RESET": "RESET",
"Policy": "Kebijakan",
"Request": "Permintaan",
"Enforcement Result": "Hasil penegakan",
"Why this result": "Mengapa hasil ini",
"SYNTAX VALIDATE": "VALIDASI SINTAKS",
"RUN THE TEST": "JALANKAN UJI",
"SHARE": "BAGIKAN",
"Copied": "Tersalin",
"COPY": "SALIN"
}
15 changes: 15 additions & 0 deletions messages/it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Custom config": "Configurazione personalizzata",
"Model": "Modello",
"Select your model": "Seleziona il tuo modello",
"RESET": "REIMPOSTA",
"Policy": "Politica",
"Request": "Richiesta",
"Enforcement Result": "Risultato dell'applicazione",
"Why this result": "Perché questo risultato",
"SYNTAX VALIDATE": "VALIDARE LA SINTASSI",
"RUN THE TEST": "ESEGUI IL TEST",
"SHARE": "CONDIVIDI",
"Copied": "Copiato",
"COPY": "COPIA"
}
15 changes: 15 additions & 0 deletions messages/ko.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Custom config": "사용자 정의 구성",
"Model": "모델",
"Select your model": "모델 선택",
"RESET": "재설정",
"Policy": "정책",
"Request": "요청",
"Enforcement Result": "집행 결과",
"Why this result": "이 결과의 이유",
"SYNTAX VALIDATE": "구문 유효성 검사",
"RUN THE TEST": "테스트 실행",
"SHARE": "공유",
"Copied": "복사됨",
"COPY": "복사"
}
15 changes: 15 additions & 0 deletions messages/ms.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Custom config": "Konfigurasi khusus",
"Model": "Model",
"Select your model": "Pilih model anda",
"RESET": "TETAPKAN SEMULA",
"Policy": "Polisi",
"Request": "Permintaan",
"Enforcement Result": "Keputusan penguatkuasaan",
"Why this result": "Mengapa keputusan ini",
"SYNTAX VALIDATE": "SAH KAN SINTAKS",
"RUN THE TEST": "JALANKAN UJIAN",
"SHARE": "KONGSI",
"Copied": "Disalin",
"COPY": "SALIN"
}
15 changes: 15 additions & 0 deletions messages/pt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Custom config": "Configuração personalizada",
"Model": "Modelo",
"Select your model": "Selecione seu modelo",
"RESET": "REINICIAR",
"Policy": "Política",
"Request": "Solicitação",
"Enforcement Result": "Resultado da aplicação",
"Why this result": "Por que esse resultado",
"SYNTAX VALIDATE": "VALIDAR SINTAXE",
"RUN THE TEST": "EXECUTAR TESTE",
"SHARE": "COMPARTILHAR",
"Copied": "Copiado",
"COPY": "COPIAR"
}
15 changes: 15 additions & 0 deletions messages/ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Custom config": "Пользовательская конфигурация",
"Model": "Модель",
"Select your model": "Выберите вашу модель",
"RESET": "СБРОС",
"Policy": "Политика",
"Request": "Запрос",
"Enforcement Result": "Результат исполнения",
"Why this result": "Почему этот результат",
"SYNTAX VALIDATE": "ПРОВЕРКА СИНТАКСИСА",
"RUN THE TEST": "ЗАПУСТИТЬ ТЕСТ",
"SHARE": "ПОДЕЛИТЬСЯ",
"Copied": "Скопировано",
"COPY": "КОПИРОВАТЬ"
}
15 changes: 15 additions & 0 deletions messages/tr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Custom config": "Özel yapılandırma",
"Model": "Model",
"Select your model": "Modelinizi seçin",
"RESET": "SIFIRLA",
"Policy": "Politika",
"Request": "İstek",
"Enforcement Result": "Uygulama Sonucu",
"Why this result": "Neden bu sonuç",
"SYNTAX VALIDATE": "SÖZDİZİMİ DOĞRULAMA",
"RUN THE TEST": "TESTİ ÇALIŞTIR",
"SHARE": "PAYLAŞ",
"Copied": "Kopyalandı",
"COPY": "KOPYALA"
}
15 changes: 15 additions & 0 deletions messages/vi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Custom config": "Cấu hình tùy chỉnh",
"Model": "Mô hình",
"Select your model": "Chọn mô hình của bạn",
"RESET": "CÀI LẠI",
"Policy": "Chính sách",
"Request": "Yêu cầu",
"Enforcement Result": "Kết quả thi hành",
"Why this result": "Tại sao kết quả này",
"SYNTAX VALIDATE": "KIỂM TRA CÚ PHÁP",
"RUN THE TEST": "CHẠY THỬ",
"SHARE": "CHIA SẺ",
"Copied": "Đã sao chép",
"COPY": "SAO CHÉP"
}

0 comments on commit 4e59fb9

Please sign in to comment.