diff --git a/READMEJP.txt b/READMEJP.txt index 135737e6..55285835 100644 --- a/READMEJP.txt +++ b/READMEJP.txt @@ -346,7 +346,9 @@ リソースの削除のバグ修正。 2018.08.18 ver.5.0.4 「新規作成」コマンドで「ダイアログの編集」が残っていたのを修正。 - 2018.XX.YY ver.5.0.5 + 2018.08.29 ver.5.0.5 + 言語名指定「English」で英語が選択されるようにした。 + 「言語別にファイルを分ける」が正しく動作されるようにした。 ///////////////////////////////////////////////////// // 片山博文MZ (katahiromz) [A.N.T.] diff --git a/include/ConstantsDB.hpp b/include/ConstantsDB.hpp index b485d7f3..32b8b3fa 100644 --- a/include/ConstantsDB.hpp +++ b/include/ConstantsDB.hpp @@ -387,6 +387,20 @@ class ConstantsDB return NameType(); } + NameType GetLangName(ValueType value) const + { + const TableType& table = GetTable(L"Languages"); + TableType::const_iterator it, end = table.end(); + for (it = table.begin(); it != end; ++it) + { + if (it->name.size() != 5 || it->name[2] != L'_') + continue; + if (it->value == value) + return it->name; + } + return NameType(); + } + ValueType GetValue(CategoryType category, NameType name) const { const TableType& table = GetTable(category); diff --git a/src/RisohEditor.cpp b/src/RisohEditor.cpp index d26be826..e031c950 100644 --- a/src/RisohEditor.cpp +++ b/src/RisohEditor.cpp @@ -7108,7 +7108,7 @@ BOOL MMainWnd::DoWriteRC(LPCWSTR pszFileName, LPCWSTR pszResH) return FALSE; // build the lang directory path - size_t diff = pch - szLangDir; + *pch = 0; StringCchCat(szLangDir, _countof(szLangDir), TEXT("/lang")); // backup and create "lang" directory @@ -7132,7 +7132,7 @@ BOOL MMainWnd::DoWriteRC(LPCWSTR pszFileName, LPCWSTR pszResH) TCHAR szLangFile[MAX_PATH]; StringCchCopy(szLangFile, _countof(szLangFile), szLangDir); StringCchCat(szLangFile, _countof(szLangFile), TEXT("/")); - MString lang_name = g_db.GetName(L"LANGUAGES", lang); + MString lang_name = g_db.GetLangName(lang); StringCchCat(szLangFile, _countof(szLangFile), lang_name.c_str()); StringCchCat(szLangFile, _countof(szLangFile), TEXT(".rc")); //MessageBox(NULL, szLangFile, NULL, 0); @@ -7172,7 +7172,7 @@ BOOL MMainWnd::DoWriteRC(LPCWSTR pszFileName, LPCWSTR pszResH) continue; // ignore neutral language // get the language name (such as en_US, ja_JP, etc.) from database - MString lang_name1 = g_db.GetName(L"LANGUAGES", lang); + MString lang_name1 = g_db.GetLangName(lang); // make uppercase one MString lang_name2 = lang_name1; @@ -7202,7 +7202,7 @@ BOOL MMainWnd::DoWriteRC(LPCWSTR pszFileName, LPCWSTR pszResH) continue; // ignore the neutral language // get the language name (such as en_US, ja_JP, etc.) from database - MString lang_name1 = g_db.GetName(L"LANGUAGES", lang); + MString lang_name1 = g_db.GetLangName(lang); // write "#include \"lang/....rc\"\r\n" file.WriteSzA("#include \"lang/");