void SetUp() { basePath = GetDllDir() + L"locales\\"; ::CreateDirectoryW(basePath.c_str(), NULL); WriteLocale(basePath, L"en", "[general]\nfoo=bar\n[x]\nx=y\n"); WriteLocale(basePath, L"es-ES", "[general]\n#comment=nada\nfoo=esbar"); WriteLocale(basePath, L"ru", "[general]\ntrash\nfoo=\xD1\x82\xD0\xB5\xD1\x81\xD1\x82\n"); }
Dictionary::Dictionary(const std::wstring& locale) { std::wstring basePath = GetDllDir() + L"locales\\"; // Always load base locale first - that's our fallback ReadDictionary(basePath, baseLocale); // Now try to load by full locale code if (locale != baseLocale && !ReadDictionary(basePath, locale)) { // Fall back to short locale name size_t pos = locale.find(L'-'); if (pos != std::wstring::npos && locale.compare(0, pos, baseLocale) != 0) ReadDictionary(basePath, locale.substr(0, pos)); } }
std::wstring HtmlFolderPath() { return GetDllDir() + L"html\\templates\\"; }