Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/chainlit/translations/ar-SA.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"favorites": {
"use": "استخدام رسالة مفضلة",
"headline": "الرسائل المفضلة",
"remove": "إزالة من المفضلة",
"empty": {
"title": "لا توجد رسائل محفوظة بعد",
"description": "ابدأ بإرسال رسالة وقم بتمييزها بنجمة أو ميّز رسالة من محادثاتك السابقة"
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/da-DK.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"favorites": {
"use": "Brug en favorit besked",
"headline": "Favorit beskeder",
"remove": "Fjern favorit",
"empty": {
"title": "Ingen gemte prompts endnu",
"description": "Start med at sende en prompt og markere den med en stjerne, eller vælg en prompt fra tidligere samtaler"
Expand Down
6 changes: 6 additions & 0 deletions backend/chainlit/translations/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@
"components": {
"MultiSelectInput": {
"placeholder": "Wähle aus..."
},
"DatePickerInput": {
"placeholder": {
"single": "Datum auswählen",
"range": "Datumsbereich auswählen"
}
}
}
}
6 changes: 6 additions & 0 deletions backend/chainlit/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@
"components": {
"MultiSelectInput": {
"placeholder": "Seleziona..."
},
"DatePickerInput": {
"placeholder": {
"single": "Scegli una data",
"range": "Scegli un intervallo di date"
}
}
}
}
1 change: 1 addition & 0 deletions backend/chainlit/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
},
"fileUpload": {
"dragDrop": "ここにファイルをドラッグ&ドロップ",
"browse": "ファイルを参照",
"sizeLimit": "制限:",
"errors": {
"failed": "アップロードに失敗しました",
Expand Down
6 changes: 6 additions & 0 deletions backend/chainlit/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@
"components": {
"MultiSelectInput": {
"placeholder": "선택..."
},
"DatePickerInput": {
"placeholder": {
"single": "날짜 선택",
"range": "날짜 범위 선택"
}
}
}
}
22 changes: 22 additions & 0 deletions backend/tests/test_translations.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import json
from io import StringIO
from pathlib import Path
from unittest.mock import patch

import pytest

from chainlit.translations import compare_json_structures, lint_translation_json

TRANSLATIONS_DIR = Path(__file__).resolve().parents[1] / "chainlit" / "translations"


class TestCompareJsonStructures:
"""Test suite for compare_json_structures function."""
Expand Down Expand Up @@ -311,6 +315,24 @@ def test_lint_output_format(self):
assert len(lines) >= 2 # At least linting message + errors


class TestPackagedTranslations:
"""Test suite for packaged locale files."""

def test_packaged_locale_files_match_en_us_structure(self):
truth_path = TRANSLATIONS_DIR / "en-US.json"
truth = json.loads(truth_path.read_text(encoding="utf-8"))

errors = []
for locale_path in sorted(TRANSLATIONS_DIR.glob("*.json")):
locale = json.loads(locale_path.read_text(encoding="utf-8"))
errors.extend(
f"{locale_path.name}: {error}"
for error in compare_json_structures(truth, locale)
)

assert errors == []


class TestTranslationsEdgeCases:
"""Test suite for edge cases in translations module."""

Expand Down