Skip to content

Commit

Permalink
Dynamically get lang folder
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Sep 8, 2024
1 parent 86de644 commit f91b5b0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions GangsTest/TestLocale/LocalFileLocalizerFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@
namespace GangsTest.TestLocale;

public class LocalFileLocalizerFactory : IStringLocalizerFactory {
private readonly string path = Path.Combine(
Directory.GetCurrentDirectory().Split("Gangs")[0], "Gangs", "Gangs",
"lang");
private readonly string path;

public LocalFileLocalizerFactory() {
var current = Directory.GetCurrentDirectory().Split("GangsTest")[^2];
var parent = Directory.GetParent(current);
if (parent is null)
throw new DirectoryNotFoundException("Could not find parent directory");
path = Path.Combine(parent.FullName, "Gangs", "lang");
Console.WriteLine(path);
}

public IStringLocalizer Create(Type resourceSource) {
return new JsonStringLocalizer(path);
Expand Down

0 comments on commit f91b5b0

Please sign in to comment.