Add translation service for web api
This commit is contained in:
@@ -1 +1,19 @@
|
||||
|
||||
namespace GameIdeas.Resources;
|
||||
|
||||
public class Translations (TranslationService translationService)
|
||||
{
|
||||
public string GamesIdeas => translationService.Translate(nameof(GamesIdeas));
|
||||
}
|
||||
|
||||
public static class ResourcesKey
|
||||
{
|
||||
private static Translations? _instance;
|
||||
|
||||
public static void Initialize(Translations translations)
|
||||
{
|
||||
_instance = translations;
|
||||
}
|
||||
|
||||
public static string GamesIdeas => _instance?.GamesIdeas ?? throw new InvalidOperationException("ResourcesKey.GamesIdeas is not initialized.");
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<#
|
||||
var path = Path.GetDirectoryName(Host.TemplateFile);
|
||||
var localPath = Host.ResolvePath(Path.Combine(path,"../../Server/GameIdeas.API/Files/GameIdeas.fr.json"));
|
||||
var localPath = Host.ResolvePath(Path.Combine(path,"../../GameIdeas/Server/GameIdeas.WebAPI/Files/GameIdeas.fr.json"));
|
||||
|
||||
var json = File.ReadAllText(localPath);
|
||||
|
||||
@@ -121,8 +121,8 @@
|
||||
|
||||
// Generate the class
|
||||
#>
|
||||
using System;
|
||||
namespace ArgosV2.Resources;
|
||||
namespace GameIdeas.Resources;
|
||||
|
||||
public class Translations (TranslationService translationService)
|
||||
{
|
||||
<#
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ArgosV2.Resources;
|
||||
namespace GameIdeas.Resources;
|
||||
|
||||
public class TranslationService
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user