Skip to content

Commit

Permalink
fix splitting by languages
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed Aug 29, 2018
1 parent 456e5cb commit 5cac177
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
4 changes: 3 additions & 1 deletion READMEJP.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.]
Expand Down
14 changes: 14 additions & 0 deletions include/ConstantsDB.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/RisohEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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/");
Expand Down

0 comments on commit 5cac177

Please sign in to comment.