mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
[General]Support language selection (#34971)
* Language setting * spellcheck * Set FileLocksmithContextMenu package version in AppManifest.xml * Fix ambigious symbol build error * Fix ambigious symbol build error #2 * Revert unneeded changes * Improve perf * try fix ci build
This commit is contained in:
22
src/common/utils/language_helper.h
Normal file
22
src/common/utils/language_helper.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <common/SettingsAPI/settings_helpers.h>
|
||||
#include <common/utils/json.h>
|
||||
|
||||
namespace LanguageHelpers
|
||||
{
|
||||
inline std::wstring load_language()
|
||||
{
|
||||
std::filesystem::path languageJsonFilePath(PTSettingsHelper::get_root_save_folder_location() + L"\\language.json");
|
||||
|
||||
auto langJson = json::from_file(languageJsonFilePath.c_str());
|
||||
if (!langJson.has_value())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::wstring language = langJson->GetNamedString(L"language", L"").c_str();
|
||||
return language;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user