Implemented new storage system, path builder, default resources, fixed lang stuff
This commit is contained in:
28
Moonlight/App/Helpers/PathBuilder.cs
Normal file
28
Moonlight/App/Helpers/PathBuilder.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace Moonlight.App.Helpers;
|
||||
|
||||
public class PathBuilder
|
||||
{
|
||||
public static string Dir(params string[] parts)
|
||||
{
|
||||
var res = "";
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
res += part + Path.DirectorySeparatorChar;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public static string File(params string[] parts)
|
||||
{
|
||||
var res = "";
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
res += part + (part == parts.Last() ? "" : Path.DirectorySeparatorChar);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ public class SmartTranslateHelper
|
||||
{
|
||||
Languages = new();
|
||||
|
||||
foreach (var file in Directory.GetFiles("resources/lang"))
|
||||
foreach (var file in Directory.GetFiles(PathBuilder.Dir("storage", "resources", "lang")))
|
||||
{
|
||||
if (Path.GetExtension(file) == ".lang")
|
||||
{
|
||||
@@ -40,7 +40,7 @@ public class SmartTranslateHelper
|
||||
{
|
||||
Languages[langKey].Add(content, content);
|
||||
|
||||
File.WriteAllLines($"resources/lang/{langKey}.lang", GenerateData(Languages[langKey]));
|
||||
File.WriteAllLines(PathBuilder.File("storage", "resources", "lang", $"{langKey}.lang"), GenerateData(Languages[langKey]));
|
||||
}
|
||||
|
||||
return Languages[langKey][content];
|
||||
|
||||
Reference in New Issue
Block a user