parent
e24c5cf8b3
commit
29c2771f5e
@ -1,14 +1,14 @@
|
|||||||
local available_languages = {"english", "english_safe", "french", "german", "italian", "polish", "portuguese",
|
local available_languages = {"english", "english_safe", "french", "german", "italian", "polish", "portuguese",
|
||||||
"russian", "spanish", "simplified_chinese", "traditional_chinese", "japanese_partial",
|
"russian", "spanish", "simplified_chinese", "traditional_chinese", "japanese_partial",
|
||||||
"korean"}
|
"korean"}
|
||||||
local current_language = "english"
|
local current_language = "LANGUAGE"
|
||||||
|
|
||||||
LUI.UIButtonText.IsOffsetedLanguage = function()
|
LUI.UIButtonText.IsOffsetedLanguage = function()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function get_current_language()
|
function get_user_language()
|
||||||
current_language = game:getcurrentgamelanguage()
|
user_language = game:getcurrentgamelanguage()
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_language(value)
|
function set_language(value)
|
||||||
@ -22,7 +22,11 @@ function does_zone_folder_exists(language)
|
|||||||
return io.directoryexists("zone/" .. language)
|
return io.directoryexists("zone/" .. language)
|
||||||
end
|
end
|
||||||
|
|
||||||
get_current_language()
|
get_user_language()
|
||||||
|
|
||||||
|
if user_language ~= "" and does_zone_folder_exists(user_language) then
|
||||||
|
current_language = user_language
|
||||||
|
end
|
||||||
|
|
||||||
LUI.addmenubutton("pc_controls", {
|
LUI.addmenubutton("pc_controls", {
|
||||||
index = 4,
|
index = 4,
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
#include <utils/properties.hpp>
|
#include <utils/properties.hpp>
|
||||||
|
|
||||||
|
#define LANGUAGE_FILE "players2/default/language"
|
||||||
|
|
||||||
namespace filesystem
|
namespace filesystem
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
@ -57,6 +59,11 @@ namespace filesystem
|
|||||||
|
|
||||||
const auto code = game::SEH_GetCurrentLanguageName();
|
const auto code = game::SEH_GetCurrentLanguageName();
|
||||||
|
|
||||||
|
if (!::utils::io::file_exists(LANGUAGE_FILE) or ::utils::io::file_size(LANGUAGE_FILE) == 0)
|
||||||
|
{
|
||||||
|
::utils::io::write_file(LANGUAGE_FILE, code);
|
||||||
|
}
|
||||||
|
|
||||||
paths.push_back(path);
|
paths.push_back(path);
|
||||||
|
|
||||||
if (is_fallback_lang())
|
if (is_fallback_lang())
|
||||||
|
@ -25,9 +25,6 @@ namespace steam
|
|||||||
strcpy_s(language, sizeof(language), content.data());
|
strcpy_s(language, sizeof(language), content.data());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// default to english if no file is found
|
|
||||||
strcpy_s(language, sizeof(language), "english");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool BIsSubscribed();
|
virtual bool BIsSubscribed();
|
||||||
|
Loading…
Reference in New Issue
Block a user