Skip to content

Commit

Permalink
feat: add i18n support for custom endpoint placeholder in EndpointSel…
Browse files Browse the repository at this point in the history
…ector
  • Loading branch information
HashCookie committed Jan 23, 2025
1 parent f9b79d9 commit ca8c51c
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 49 deletions.
4 changes: 3 additions & 1 deletion app/components/editor/common/EndpointSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from 'react';
import { clsx } from 'clsx';
import { DEFAULT_ENDPOINT } from '@/app/components/hooks/useRemoteEnforcer';
import { useLang } from '@/app/context/LangContext';

const ENDPOINTS = [
DEFAULT_ENDPOINT,
'demo.casdoor.com'
];

export const EndpointSelector: React.FC = () => {
const { t } = useLang();
const [isOpen, setIsOpen] = React.useState(false);
const storedEndpoint = window.localStorage.getItem('casbinEndpoint') || DEFAULT_ENDPOINT;
const [selectedEndpoint, setSelectedEndpoint] = React.useState(storedEndpoint);
Expand Down Expand Up @@ -105,7 +107,7 @@ export const EndpointSelector: React.FC = () => {
type="text"
value={customEndpoint}
onChange={handleCustomEndpointChange}
placeholder="Enter custom endpoint"
placeholder={t('Enter custom endpoint')}
className={clsx(
'border border-gray-300 rounded',
'px-2 py-1',
Expand Down
5 changes: 2 additions & 3 deletions messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "حدد النموذج الخاص بك",
"RESET": "إعادة ضبط",
"Policy": "سياسة",
"Compare": "مقارنة",
"Request": "طلب",
"Load": "تحميل",
"Enforcement Result": "نتيجة التنفيذ",
"Why this result": "لماذا هذه النتيجة",
"RUN THE TEST": "تشغيل الاختبار",
Expand All @@ -18,5 +16,6 @@
"Share failed": "مشاركة فشلت",
"No content to share": "لا يوجد محتوى للمشاركة",
"Link copied to clipboard": "رابط منسوخ إلى الملف المطلق",
"Test completed successfully": "اختبار منجز بنجاح"
"Test completed successfully": "اختبار منجز بنجاح",
"Enter custom endpoint": "أدخل نهاية مخصصة"
}
5 changes: 2 additions & 3 deletions messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "Wählen Sie Ihr Modell",
"RESET": "Zurücksetzen",
"Policy": "Richtlinie",
"Compare": "Vergleichen",
"Request": "Anfrage",
"Load": "Laden",
"Enforcement Result": "Durchsetzungsergebnis",
"Why this result": "Warum dieses Ergebnis?",
"RUN THE TEST": "Test ausführen",
Expand All @@ -18,5 +16,6 @@
"Share failed": "Teilen fehlgeschlagen",
"No content to share": "Kein Inhalt zum Teilen",
"Link copied to clipboard": "Link in die Zwischenablage kopiert",
"Test completed successfully": "Test erfolgreich abgeschlossen"
"Test completed successfully": "Test erfolgreich abgeschlossen",
"Enter custom endpoint": "Benutzerdefinierte Endpunkt eingeben"
}
5 changes: 2 additions & 3 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "Select your model",
"RESET": "RESET",
"Policy": "Policy",
"Compare": "Compare",
"Request": "Request",
"Load": "Load",
"Enforcement Result": "Enforcement Result",
"Why this result": "Why this result",
"RUN THE TEST": "RUN THE TEST",
Expand All @@ -18,5 +16,6 @@
"Share failed": "Share failed",
"No content to share": "No content to share",
"Link copied to clipboard": "Link copied to clipboard",
"Test completed successfully": "Test completed successfully"
"Test completed successfully": "Test completed successfully",
"Enter custom endpoint": "Enter custom endpoint"
}
5 changes: 2 additions & 3 deletions messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "Seleccione su modelo",
"RESET": "REINICIAR",
"Policy": "Política",
"Compare": "Comparar",
"Request": "Solicitud",
"Load": "Cargar",
"Enforcement Result": "Resultado de ejecución",
"Why this result": "Por qué este resultado",
"RUN THE TEST": "EJECUTAR PRUEBA",
Expand All @@ -18,5 +16,6 @@
"Share failed": "Compartir falló",
"No content to share": "No hay contenido para compartir",
"Link copied to clipboard": "Enlace copiado en el portapapeles",
"Test completed successfully": "Prueba completada con éxito"
"Test completed successfully": "Prueba completada con éxito",
"Enter custom endpoint": "Ingrese el endpoint personalizado"
}
5 changes: 2 additions & 3 deletions messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "Sélectionnez votre modèle",
"RESET": "Réinitialiser",
"Policy": "Politique",
"Compare": "Comparer",
"Request": "Requête",
"Load": "Charger",
"Enforcement Result": "Résultat d'application",
"Why this result": "Pourquoi ce résultat ?",
"RUN THE TEST": "Exécuter le test",
Expand All @@ -18,5 +16,6 @@
"Share failed": "Partage échoué",
"No content to share": "Aucun contenu à partager",
"Link copied to clipboard": "Lien copié dans le presse-papiers",
"Test completed successfully": "Test terminé avec succès"
"Test completed successfully": "Test terminé avec succès",
"Enter custom endpoint": "Entrez l'endpoint personnalisé"
}
5 changes: 2 additions & 3 deletions messages/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "Pilih model Anda",
"RESET": "RESET",
"Policy": "Kebijakan",
"Compare": "Membandingkan",
"Request": "Permintaan",
"Load": "Muat",
"Enforcement Result": "Hasil penegakan",
"Why this result": "Mengapa hasil ini",
"RUN THE TEST": "JALANKAN UJI",
Expand All @@ -18,5 +16,6 @@
"Share failed": "Membagikan gagal",
"No content to share": "Tidak ada konten untuk dibagikan",
"Link copied to clipboard": "Tautan disalin ke clipboard",
"Test completed successfully": "Uji berhasil"
"Test completed successfully": "Uji berhasil",
"Enter custom endpoint": "Masukkan endpoint kustom"
}
5 changes: 2 additions & 3 deletions messages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "Seleziona il tuo modello",
"RESET": "REIMPOSTA",
"Policy": "Politica",
"Compare": "Confronta",
"Request": "Richiesta",
"Load": "Carica",
"Enforcement Result": "Risultato dell'applicazione",
"Why this result": "Perché questo risultato",
"RUN THE TEST": "ESEGUI IL TEST",
Expand All @@ -18,5 +16,6 @@
"Share failed": "Condivisione fallita",
"No content to share": "Nessun contenuto da condividere",
"Link copied to clipboard": "Link copiato nel portapapele",
"Test completed successfully": "Test completato con successo"
"Test completed successfully": "Test completato con successo",
"Enter custom endpoint": "Inserisci l'endpoint personalizzato"
}
5 changes: 2 additions & 3 deletions messages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "モデルを選択",
"RESET": "リセット",
"Policy": "ポリシー",
"Compare": "比較",
"Request": "リクエスト",
"Load": "ロード",
"Enforcement Result": "実行結果",
"Why this result": "なぜこの結果?",
"RUN THE TEST": "テスト実行",
Expand All @@ -18,5 +16,6 @@
"Share failed": "共有失敗",
"No content to share": "共有する内容がありません",
"Link copied to clipboard": "リンクがクリップボードにコピーされました",
"Test completed successfully": "テストが完了しました"
"Test completed successfully": "テストが完了しました",
"Enter custom endpoint": "カスタムエンドポイントを入力"
}
5 changes: 2 additions & 3 deletions messages/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "모델 선택",
"RESET": "재설정",
"Policy": "정책",
"Compare": "비교",
"Request": "요청",
"Load": "로드",
"Enforcement Result": "집행 결과",
"Why this result": "이 결과의 이유",
"RUN THE TEST": "테스트 실행",
Expand All @@ -18,5 +16,6 @@
"Share failed": "공유 실패",
"No content to share": "공유할 내용이 없습니다",
"Link copied to clipboard": "링크가 클립보드에 복사되었습니다",
"Test completed successfully": "테스트가 완료되었습니다"
"Test completed successfully": "테스트가 완료되었습니다",
"Enter custom endpoint": "사용자 정의 엔드포인트 입력"
}
5 changes: 2 additions & 3 deletions messages/ms.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "Pilih model anda",
"RESET": "TETAPKAN SEMULA",
"Policy": "Polisi",
"Compare": "Membandingkan",
"Request": "Permintaan",
"Load": "Muat",
"Enforcement Result": "Keputusan penguatkuasaan",
"Why this result": "Mengapa keputusan ini",
"RUN THE TEST": "JALANKAN UJIAN",
Expand All @@ -18,5 +16,6 @@
"Share failed": "Mengongsikan gagal",
"No content to share": "Tidak ada konten untuk dibagikan",
"Link copied to clipboard": "Tautan disalin ke clipboard",
"Test completed successfully": "Uji berhasil"
"Test completed successfully": "Uji berhasil",
"Enter custom endpoint": "Masukkan endpoint kustom"
}
5 changes: 2 additions & 3 deletions messages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "Selecione seu modelo",
"RESET": "REINICIAR",
"Policy": "Política",
"Compare": "Comparar",
"Request": "Solicitação",
"Load": "Carregar",
"Enforcement Result": "Resultado da aplicação",
"Why this result": "Por que esse resultado",
"RUN THE TEST": "EXECUTAR TESTE",
Expand All @@ -18,5 +16,6 @@
"Share failed": "Compartilhamento falhou",
"No content to share": "Não há conteúdo para compartilhar",
"Link copied to clipboard": "Link copiado para o clipboard",
"Test completed successfully": "Teste concluído com sucesso"
"Test completed successfully": "Teste concluído com sucesso",
"Enter custom endpoint": "Insira o endpoint personalizado"
}
5 changes: 2 additions & 3 deletions messages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "Выберите вашу модель",
"RESET": "СБРОС",
"Policy": "Политика",
"Compare": "Сравнить",
"Request": "Запрос",
"Load": "Загрузить",
"Enforcement Result": "Результат исполнения",
"Why this result": "Почему этот результат",
"RUN THE TEST": "ЗАПУСТИТЬ ТЕСТ",
Expand All @@ -18,5 +16,6 @@
"Share failed": "Поделиться не удалось",
"No content to share": "Нет содержимого для разделения",
"Link copied to clipboard": "Ссылка скопирована в буфер обмена",
"Test completed successfully": "Тест завершен успешно"
"Test completed successfully": "Тест завершен успешно",
"Enter custom endpoint": "Введите пользовательский конечный пункт"
}
5 changes: 2 additions & 3 deletions messages/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "Modelinizi seçin",
"RESET": "SIFIRLA",
"Policy": "Politika",
"Compare": "Karşılaştır",
"Request": "İstek",
"Load": "Yükle",
"Enforcement Result": "Uygulama Sonucu",
"Why this result": "Neden bu sonuç",
"RUN THE TEST": "TESTİ ÇALIŞTIR",
Expand All @@ -18,5 +16,6 @@
"Share failed": "Paylaşım başarısız",
"No content to share": "Paylaşılacak içerik yok",
"Link copied to clipboard": "Link kopyalandı",
"Test completed successfully": "Test başarıyla tamamlandı"
"Test completed successfully": "Test başarıyla tamamlandı",
"Enter custom endpoint": "Özel endpoint girin"
}
5 changes: 2 additions & 3 deletions messages/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "Chọn mô hình của bạn",
"RESET": "CÀI LẠI",
"Policy": "Chính sách",
"Compare": "So sánh",
"Request": "Yêu cầu",
"Load": "Tải",
"Enforcement Result": "Kết quả thi hành",
"Why this result": "Tại sao kết quả này",
"RUN THE TEST": "CHẠY THỬ",
Expand All @@ -18,5 +16,6 @@
"Share failed": "Chia sẻ thất bại",
"No content to share": "Không có nội dung để chia sẻ",
"Link copied to clipboard": "Link đã được sao chép vào clipboard",
"Test completed successfully": "Test hoàn tất thành công"
"Test completed successfully": "Test hoàn tất thành công",
"Enter custom endpoint": "Nhập điểm cuối tùy chỉnh"
}
5 changes: 2 additions & 3 deletions messages/zh-Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "選擇模型",
"RESET": "重置",
"Policy": "策略",
"Compare": "比較",
"Request": "請求",
"Load": "上傳",
"Enforcement Result": "執行結果",
"Why this result": "為何此結果?",
"RUN THE TEST": "運行",
Expand All @@ -18,5 +16,6 @@
"Share failed": "分享失敗",
"No content to share": "沒有內容可以分享",
"Link copied to clipboard": "連結已複製到剪貼簿",
"Test completed successfully": "測試成功"
"Test completed successfully": "測試成功",
"Enter custom endpoint": "輸入自定義端點"
}
5 changes: 2 additions & 3 deletions messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"Select your model": "选择模型",
"RESET": "重置",
"Policy": "策略",
"Compare": "比较",
"Request": "请求",
"Load": "上传",
"Enforcement Result": "执行结果",
"Why this result": "为何此结果?",
"RUN THE TEST": "运行",
Expand All @@ -18,5 +16,6 @@
"Share failed": "分享失败",
"No content to share": "没有内容可以分享",
"Link copied to clipboard": "链接已复制到剪贴板",
"Test completed successfully": "测试成功"
"Test completed successfully": "测试成功",
"Enter custom endpoint": "输入自定义端点"
}

0 comments on commit ca8c51c

Please sign in to comment.