Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AssetEditor/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected override void OnStartup(StartupEventArgs e)
if (settingsService.CurrentSettings.IsFirstTimeStartingApplication)
{
var detectedLang = DetectSystemLanguage();
if (File.Exists($"Language_{detectedLang}.json"))
if (File.Exists(Path.Combine(AppContext.BaseDirectory, $"Language_{detectedLang}.json")))
settingsService.CurrentSettings.SelectedLangauge = detectedLang;
settingsService.Save();
}
Expand Down
5 changes: 4 additions & 1 deletion AssetEditor/AssetEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,15 @@
<ItemGroup>
<None Update="Language_Cn.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
</None>
<None Update="Language_Fr.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
</None>
<None Update="Language_En.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
</None>
</ItemGroup>

Expand Down Expand Up @@ -118,4 +121,4 @@

<MSBuild Projects="$(UpdaterProject)" Targets="Restore;Publish" Properties="PublishDir=$(AbsolutePublishDir);Configuration=$(Configuration);RuntimeIdentifier=$(RuntimeIdentifier);SelfContained=$(SelfContained);PublishSingleFile=$(PublishSingleFile);PublishReadyToRun=$(PublishReadyToRun)" />
</Target>
</Project>
</Project>
7 changes: 3 additions & 4 deletions Shared/SharedCore/Shared.Core/Services/LocalizationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public class LocalizationManager

public List<string> GetPossibleLanguages()
{
var currentDirectory = Directory.GetCurrentDirectory();
var langaugeFiles = Directory.GetFiles(currentDirectory, "Language_*.json")
var langaugeFiles = Directory.GetFiles(AppContext.BaseDirectory, "Language_*.json")
.Select(Path.GetFileNameWithoutExtension)
.Select(name => name!.Substring("Language_".Length).ToLower())
.ToList();
Expand All @@ -28,11 +27,11 @@ public void LoadLanguage(string languageCode)
{
_selectedLangauge = languageCode.ToLower();

var languageFile= $"Language_{_selectedLangauge}.json";
var languageFile = Path.Combine(AppContext.BaseDirectory, $"Language_{_selectedLangauge}.json");
if (File.Exists(languageFile) == false)
{
MessageBox.Show($"Language file for code '{_selectedLangauge}' not found.");
_logger.Here().Error($"Language file for code '{_selectedLangauge}' not found. in {Directory.GetCurrentDirectory()}");
_logger.Here().Error($"Language file for code '{_selectedLangauge}' not found in {AppContext.BaseDirectory}");
return;
}

Expand Down
Loading