Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIチャット #132

Merged
merged 17 commits into from
Feb 6, 2025
Merged
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
114 changes: 114 additions & 0 deletions Assets/uDesktopMascot/Editor/EditorTest/CsvLocalizationTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#if UNITY_EDITOR || UNITY_INCLUDE_TESTS

using NUnit.Framework;
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Collections.Generic;

namespace uDesktopMascot.Editor.EditorTest
{
public class CsvLocalizationTests
{
[Test]
public void LocalizationCsvShouldNotHaveEmptyEntries()
{
// CSVファイルのパス
string csvPath = "Assets/uDesktopMascot/LocalizationTable/LocalizationTable.csv";

if (!File.Exists(csvPath))
{
Assert.Fail($"CSVファイルが見つかりませんでした: {csvPath}");
}

string[] lines = File.ReadAllLines(csvPath);

if (lines.Length == 0)
{
Assert.Fail("CSVファイルが空です。");
}

// ヘッダー行(最初の行)を取得
string headerLine = lines[0];
string[] headers = SplitCsvLine(headerLine);

// 言語列を特定(キー列を除く)
List<string> languages = new List<string>();
for (int i = 1; i < headers.Length; i++) // 最初の列はキーと仮定
{
languages.Add(headers[i]);
}

// 各行を処理
for (int lineNumber = 1; lineNumber < lines.Length; lineNumber++)
{
string line = lines[lineNumber];
if (string.IsNullOrWhiteSpace(line))
{
continue; // 空行はスキップ
}

string[] columns = SplitCsvLine(line);

if (columns.Length != headers.Length)
{
Assert.Fail($"行 {lineNumber + 1}: 列の数がヘッダーと一致しません。期待される列数: {headers.Length}, 実際の列数: {columns.Length}");
}

string key = columns[0];

for (int i = 1; i < columns.Length; i++)
{
string value = columns[i];
if (string.IsNullOrWhiteSpace(value))
{
string language = headers[i];
Assert.Fail($"行 {lineNumber + 1}: キー '{key}' の言語 '{language}' の値が空です。");
}
}
}
}

// CSVの1行を分割するヘルパーメソッド
private string[] SplitCsvLine(string line)
{
List<string> fields = new List<string>();
bool inQuotes = false;
string field = "";

for (int i = 0; i < line.Length; i++)
{
char c = line[i];

if (c == '"')
{
if (inQuotes && i + 1 < line.Length && line[i + 1] == '"')
{
// エスケープされたダブルクオート
field += '"';
i++; // 次のダブルクオートをスキップ
}
else
{
inQuotes = !inQuotes;
}
}
else if (c == ',' && !inQuotes)
{
fields.Add(field);
field = "";
}
else
{
field += c;
}
}

fields.Add(field);

return fields.ToArray();
}
}
}

#endif

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions Assets/uDesktopMascot/Editor/EditorTest/LocalizationTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#if UNITY_EDITOR || UNITY_INCLUDE_TESTS

using NUnit.Framework;
using UnityEngine;
using UnityEditor;
using UnityEngine.Localization;
using UnityEngine.Localization.Tables;
using UnityEditor.Localization;
using System.IO;

namespace uDesktopMascot.Editor.EditorTest
{
public class LocalizationTests
{
[Test]
public void LocalizationTablesShouldNotHaveEmptyEntries()
{
// ローカリゼーションテーブルが格納されているフォルダのパスを指定
string localizationFolderPath = "Assets/uDesktopMascot/LocalizationTable";
string[] tableGuids = AssetDatabase.FindAssets("t:StringTable", new[] { localizationFolderPath });

foreach (string tableGuid in tableGuids)
{
string path = AssetDatabase.GUIDToAssetPath(tableGuid);
var table = AssetDatabase.LoadAssetAtPath<StringTable>(path);

if (table == null)
{
continue;
}

// ロケール識別子を取得
var localeIdentifier = table.LocaleIdentifier.Code;

// テーブル内の各エントリを処理
foreach (var entry in table.Values)
{
// エントリの値を取得
string entryValue = entry.Value;

if (string.IsNullOrWhiteSpace(entryValue))
{
// エントリが空白の場合、テストを失敗させる
Assert.Fail($"テーブル '{table.name}' のロケール '{localeIdentifier}' のキー '{entry.Key}' に空の文字列があります。");
}
}
}
}
}
}

#endif

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,16 @@ MonoBehaviour:
m_Key: MSG_SKIP_UPDATE_DIALOG_TOGGLE_TEXT
m_Metadata:
m_Items: []
- m_Id: 3977592391348224
m_Key: WORD_MENU_WEB_UI
- m_Id: 4547369455259648
m_Key: WORD_SEND_MESSAGE_BUTTON_TEXT
m_Metadata:
m_Items: []
- m_Id: 4599798494334976
m_Key: WORD_AI_CHAT
m_Metadata:
m_Items: []
- m_Id: 4600571496173568
m_Key: WORD_WEB_UI_BUTTON
m_Metadata:
m_Items: []
m_Metadata:
Expand Down
3 changes: 3 additions & 0 deletions Assets/uDesktopMascot/LocalizationTable/LocalizationTable.csv
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ Key,Id,English(en),French(fr),Italian(it),Japanese(ja),Korean(ko)
"MSG_NEW_VERSION",2499933916303360,"A new version v{0} has been released.","La nouvelle version de v{0} a été publiée.","È stata rilasciata la nuova versione di v{0}.","新しいVerのv{0}が\nリリースされています","새로운 Ver의 v{0}가\n배포되었습니다"
"WORD_CLOSE_BUTTON_TEXT",3116372423544832,"Close","Fermer","Chiudere","閉じる","닫기"
"MSG_SKIP_UPDATE_DIALOG_TOGGLE_TEXT",3116588740579328,"Do not display the dialog until the next version.","Ne pas afficher de dialogue jusqu'à la prochaine version","Non mostrare il dialogo fino alla prossima versione.","次のversionまでダイアログを表示しない","다음 버전까지 다이얼로그를 표시하지 않음"
"WORD_SEND_MESSAGE_BUTTON_TEXT",4547369455259648,"Send","Envoi","Invio","送信","전송"
"WORD_AI_CHAT",4599798494334976,"Chat","Chat","Chat","チャット","챗봇"
"WORD_WEB_UI_BUTTON",4600571496173568,"Web UI","Interface utilisateur web","Interfaccia web","ウェブUI","웹 UI"
14 changes: 11 additions & 3 deletions Assets/uDesktopMascot/LocalizationTable/LocalizationTable_en.asset
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ MonoBehaviour:
m_Metadata:
m_Items: []
- m_Id: 557971768283136
m_Localized:
m_Localized: Model addition/change
m_Metadata:
m_Items: []
- m_Id: 557971768283134
Expand All @@ -48,8 +48,16 @@ MonoBehaviour:
m_Localized: Do not display the dialog until the next version.
m_Metadata:
m_Items: []
- m_Id: 3977592391348224
m_Localized: WebUI
- m_Id: 4547369455259648
m_Localized: Send
m_Metadata:
m_Items: []
- m_Id: 4599798494334976
m_Localized: Chat
m_Metadata:
m_Items: []
- m_Id: 4600571496173568
m_Localized: Web UI
m_Metadata:
m_Items: []
references:
Expand Down
14 changes: 11 additions & 3 deletions Assets/uDesktopMascot/LocalizationTable/LocalizationTable_fr.asset
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ MonoBehaviour:
m_Metadata:
m_Items: []
- m_Id: 557971768283136
m_Localized:
m_Localized: "Ajout ou modification de mod\xE8le"
m_Metadata:
m_Items: []
- m_Id: 557971768283134
Expand All @@ -48,8 +48,16 @@ MonoBehaviour:
m_Localized: "Ne pas afficher de dialogue jusqu'\xE0 la prochaine version"
m_Metadata:
m_Items: []
- m_Id: 3977592391348224
m_Localized: Interface utilisateur Web
- m_Id: 4547369455259648
m_Localized: Envoi
m_Metadata:
m_Items: []
- m_Id: 4599798494334976
m_Localized: Chat
m_Metadata:
m_Items: []
- m_Id: 4600571496173568
m_Localized: Interface utilisateur web
m_Metadata:
m_Items: []
references:
Expand Down
14 changes: 11 additions & 3 deletions Assets/uDesktopMascot/LocalizationTable/LocalizationTable_it.asset
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ MonoBehaviour:
m_Metadata:
m_Items: []
- m_Id: 557971768283136
m_Localized:
m_Localized: Aggiunta o modifica del modello
m_Metadata:
m_Items: []
- m_Id: 557971768283134
Expand All @@ -48,8 +48,16 @@ MonoBehaviour:
m_Localized: Non mostrare il dialogo fino alla prossima versione.
m_Metadata:
m_Items: []
- m_Id: 3977592391348224
m_Localized: Interfaccia utente Web
- m_Id: 4547369455259648
m_Localized: Invio
m_Metadata:
m_Items: []
- m_Id: 4599798494334976
m_Localized: Chat
m_Metadata:
m_Items: []
- m_Id: 4600571496173568
m_Localized: Interfaccia web
m_Metadata:
m_Items: []
references:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ MonoBehaviour:
m_Localized: "\u6B21\u306Eversion\u307E\u3067\u30C0\u30A4\u30A2\u30ED\u30B0\u3092\u8868\u793A\u3057\u306A\u3044"
m_Metadata:
m_Items: []
- m_Id: 3977592391348224
- m_Id: 4547369455259648
m_Localized: "\u9001\u4FE1"
m_Metadata:
m_Items: []
- m_Id: 4599798494334976
m_Localized: "\u30C1\u30E3\u30C3\u30C8"
m_Metadata:
m_Items: []
- m_Id: 4600571496173568
m_Localized: "\u30A6\u30A7\u30D6UI"
m_Metadata:
m_Items: []
Expand Down
12 changes: 10 additions & 2 deletions Assets/uDesktopMascot/LocalizationTable/LocalizationTable_ko.asset
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ MonoBehaviour:
m_Metadata:
m_Items: []
- m_Id: 557971768283136
m_Localized:
m_Localized: "\uBAA8\uB378 \uCD94\uAC00\u30FB\uBCC0\uACBD"
m_Metadata:
m_Items: []
- m_Id: 557971768283134
Expand All @@ -49,7 +49,15 @@ MonoBehaviour:
\uD45C\uC2DC\uD558\uC9C0 \uC54A\uC74C"
m_Metadata:
m_Items: []
- m_Id: 3977592391348224
- m_Id: 4547369455259648
m_Localized: "\uC804\uC1A1"
m_Metadata:
m_Items: []
- m_Id: 4599798494334976
m_Localized: "\uCC57\uBD07"
m_Metadata:
m_Items: []
- m_Id: 4600571496173568
m_Localized: "\uC6F9 UI"
m_Metadata:
m_Items: []
Expand Down
Loading
Loading