feat(l10n): 번역 함수 개선 및 부활 메시지 추가
- toTitleCase 함수로 대소문자 정규화 - translateMonster 대소문자 무시 검색 지원 - translateItemNameL10n에 boringItem 번역 추가 - animationResurrecting 메시지 추가 - deathGoldRemaining → deathCoinRemaining
This commit is contained in:
@@ -22,6 +22,16 @@ bool get isKoreanLocale => _currentLocale == 'ko';
|
|||||||
/// 일본어 여부 확인
|
/// 일본어 여부 확인
|
||||||
bool get isJapaneseLocale => _currentLocale == 'ja';
|
bool get isJapaneseLocale => _currentLocale == 'ja';
|
||||||
|
|
||||||
|
/// 각 단어 첫 글자를 대문자로 변환 (Title Case)
|
||||||
|
///
|
||||||
|
/// 예: "syntax error" → "Syntax Error"
|
||||||
|
String _toTitleCase(String text) {
|
||||||
|
return text.split(' ').map((word) {
|
||||||
|
if (word.isEmpty) return word;
|
||||||
|
return word[0].toUpperCase() + word.substring(1).toLowerCase();
|
||||||
|
}).join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// 프롤로그 텍스트
|
// 프롤로그 텍스트
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -103,6 +113,13 @@ String taskSelling(String itemDescription) {
|
|||||||
// 부활 시퀀스 메시지
|
// 부활 시퀀스 메시지
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
/// 부활 애니메이션 중 표시 메시지
|
||||||
|
String get animationResurrecting {
|
||||||
|
if (isKoreanLocale) return '부활 중...';
|
||||||
|
if (isJapaneseLocale) return '復活中...';
|
||||||
|
return 'Resurrecting...';
|
||||||
|
}
|
||||||
|
|
||||||
String get taskReturningToTown {
|
String get taskReturningToTown {
|
||||||
if (isKoreanLocale) return '마을로 귀환 중...';
|
if (isKoreanLocale) return '마을로 귀환 중...';
|
||||||
if (isJapaneseLocale) return '町に戻っている...';
|
if (isJapaneseLocale) return '町に戻っている...';
|
||||||
@@ -149,10 +166,10 @@ String get deathNoSacrificeNeeded {
|
|||||||
return 'No sacrifice needed';
|
return 'No sacrifice needed';
|
||||||
}
|
}
|
||||||
|
|
||||||
String get deathGoldRemaining {
|
String get deathCoinRemaining {
|
||||||
if (isKoreanLocale) return '남은 골드';
|
if (isKoreanLocale) return '남은 코인';
|
||||||
if (isJapaneseLocale) return '残りゴールド';
|
if (isJapaneseLocale) return '残りコイン';
|
||||||
return 'Gold Remaining';
|
return 'Coin Remaining';
|
||||||
}
|
}
|
||||||
|
|
||||||
String get deathResurrect {
|
String get deathResurrect {
|
||||||
@@ -879,14 +896,23 @@ String namedMonsterFormat(String generatedName, String monsterType) {
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
/// 몬스터 이름 번역 (기본 + 고급 몬스터 포함)
|
/// 몬스터 이름 번역 (기본 + 고급 몬스터 포함)
|
||||||
|
///
|
||||||
|
/// 대소문자 무시 검색: "syntax error" → "Syntax Error"로 변환 후 검색
|
||||||
String translateMonster(String englishName) {
|
String translateMonster(String englishName) {
|
||||||
|
// 대소문자 무시를 위해 Title Case로 변환
|
||||||
|
final titleCaseName = _toTitleCase(englishName);
|
||||||
|
|
||||||
if (isKoreanLocale) {
|
if (isKoreanLocale) {
|
||||||
return monsterTranslationsKo[englishName] ??
|
return monsterTranslationsKo[titleCaseName] ??
|
||||||
|
advancedMonsterTranslationsKo[titleCaseName] ??
|
||||||
|
monsterTranslationsKo[englishName] ??
|
||||||
advancedMonsterTranslationsKo[englishName] ??
|
advancedMonsterTranslationsKo[englishName] ??
|
||||||
englishName;
|
englishName;
|
||||||
}
|
}
|
||||||
if (isJapaneseLocale) {
|
if (isJapaneseLocale) {
|
||||||
return monsterTranslationsJa[englishName] ??
|
return monsterTranslationsJa[titleCaseName] ??
|
||||||
|
advancedMonsterTranslationsJa[titleCaseName] ??
|
||||||
|
monsterTranslationsJa[englishName] ??
|
||||||
advancedMonsterTranslationsJa[englishName] ??
|
advancedMonsterTranslationsJa[englishName] ??
|
||||||
englishName;
|
englishName;
|
||||||
}
|
}
|
||||||
@@ -1043,15 +1069,18 @@ String translateItemNameL10n(String itemString) {
|
|||||||
final words = itemString.split(' ');
|
final words = itemString.split(' ');
|
||||||
if (words.length >= 2) {
|
if (words.length >= 2) {
|
||||||
// 2-1. 마지막 2단어가 드롭 아이템인지 먼저 확인 (예: "outdated syntax")
|
// 2-1. 마지막 2단어가 드롭 아이템인지 먼저 확인 (예: "outdated syntax")
|
||||||
|
// boringItemTranslations도 확인 (2단어 boringItem: "null pointer" 등)
|
||||||
if (words.length >= 3) {
|
if (words.length >= 3) {
|
||||||
final lastTwoWords = '${words[words.length - 2]} ${words.last}'
|
final lastTwoWords = '${words[words.length - 2]} ${words.last}'
|
||||||
.toLowerCase();
|
.toLowerCase();
|
||||||
final dropKo2 =
|
final dropKo2 =
|
||||||
dropItemTranslationsKo[lastTwoWords] ??
|
dropItemTranslationsKo[lastTwoWords] ??
|
||||||
additionalDropTranslationsKo[lastTwoWords];
|
additionalDropTranslationsKo[lastTwoWords] ??
|
||||||
|
boringItemTranslationsKo[lastTwoWords];
|
||||||
final dropJa2 =
|
final dropJa2 =
|
||||||
dropItemTranslationsJa[lastTwoWords] ??
|
dropItemTranslationsJa[lastTwoWords] ??
|
||||||
additionalDropTranslationsJa[lastTwoWords];
|
additionalDropTranslationsJa[lastTwoWords] ??
|
||||||
|
boringItemTranslationsJa[lastTwoWords];
|
||||||
|
|
||||||
if (dropKo2 != null || dropJa2 != null) {
|
if (dropKo2 != null || dropJa2 != null) {
|
||||||
final monsterPart = words.sublist(0, words.length - 2).join(' ');
|
final monsterPart = words.sublist(0, words.length - 2).join(' ');
|
||||||
@@ -1065,13 +1094,16 @@ String translateItemNameL10n(String itemString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2-2. 마지막 단어가 드롭 아이템인지 확인
|
// 2-2. 마지막 단어가 드롭 아이템인지 확인
|
||||||
|
// boringItemTranslations도 확인 (monsterPart로 사용되는 경우)
|
||||||
final lastWord = words.last.toLowerCase();
|
final lastWord = words.last.toLowerCase();
|
||||||
final dropKo =
|
final dropKo =
|
||||||
dropItemTranslationsKo[lastWord] ??
|
dropItemTranslationsKo[lastWord] ??
|
||||||
additionalDropTranslationsKo[lastWord];
|
additionalDropTranslationsKo[lastWord] ??
|
||||||
|
boringItemTranslationsKo[lastWord];
|
||||||
final dropJa =
|
final dropJa =
|
||||||
dropItemTranslationsJa[lastWord] ??
|
dropItemTranslationsJa[lastWord] ??
|
||||||
additionalDropTranslationsJa[lastWord];
|
additionalDropTranslationsJa[lastWord] ??
|
||||||
|
boringItemTranslationsJa[lastWord];
|
||||||
|
|
||||||
if (dropKo != null || dropJa != null) {
|
if (dropKo != null || dropJa != null) {
|
||||||
// 앞 부분은 몬스터 이름
|
// 앞 부분은 몬스터 이름
|
||||||
|
|||||||
Reference in New Issue
Block a user