-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f92260
commit dd1ce00
Showing
10 changed files
with
142 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.IO; | ||
using System.IO.Abstractions; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace ManagedCommon | ||
{ | ||
public static class LanguageHelper | ||
{ | ||
public const string SettingsFilePath = "\\Microsoft\\PowerToys\\"; | ||
public const string SettingsFile = "language.json"; | ||
|
||
internal sealed class OutGoingLanguageSettings | ||
{ | ||
[JsonPropertyName("language")] | ||
public string LanguageTag { get; set; } | ||
} | ||
|
||
public static string LoadLanguage() | ||
{ | ||
FileSystem fileSystem = new FileSystem(); | ||
var localAppDataDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); | ||
var file = localAppDataDir + SettingsFilePath + SettingsFile; | ||
|
||
if (fileSystem.File.Exists(file)) | ||
{ | ||
try | ||
{ | ||
Stream inputStream = fileSystem.File.Open(file, FileMode.Open); | ||
StreamReader reader = new StreamReader(inputStream); | ||
string data = reader.ReadToEnd(); | ||
inputStream.Close(); | ||
reader.Dispose(); | ||
|
||
return JsonSerializer.Deserialize<OutGoingLanguageSettings>(data).LanguageTag; | ||
} | ||
catch (Exception) | ||
{ | ||
} | ||
} | ||
|
||
return string.Empty; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dd1ce00
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@check-spelling-bot Report
🔴 Please review
See the 📜action log or 📝 job summary for details.
Unrecognized words (1)
initlanguages
Previously acknowledged words that are now absent
applayout appsfolder cswinrt systemsettings SYSTEMWOW USEPOSITION USESIZE 🫥To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands
... in a clone of the [email protected]:microsoft/PowerToys.git repository
on the
stefan/lang_override
branch (ℹ️ how do I use this?):Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary
This includes both expected items (1897) from .github/actions/spell-check/expect.txt and unrecognized words (1)
Consider adding them (in
.github/workflows/spelling2.yml
) foruses: check-spelling/[email protected]
in itswith
:To stop checking additional dictionaries, add (in
.github/workflows/spelling2.yml
) foruses: check-spelling/[email protected]
in itswith
:Warnings (1)
See the 📜action log or 📝 job summary for details.
See ℹ️ Event descriptions for more information.
If the flagged items are 🤯 false positives
If items relate to a ...
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txt
file matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^
refers to the file's path from the root of the repository, so^README\.md$
would exclude README.md (on whichever branch you're using).well-formed pattern.
If you can write a pattern that would match it,
try adding it to the
patterns.txt
file.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.