ITranslator
This commit is contained in:
46
ReportImp/ApiBerlin/Translation/TranslationDictionary.cs
Normal file
46
ReportImp/ApiBerlin/Translation/TranslationDictionary.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
|
||||
namespace ApiBerlin.Translation
|
||||
{
|
||||
public class ApiTranslationDictionary : TranslationDictionary
|
||||
{
|
||||
public override Dictionary<String, String> GetTranslationDictionary()
|
||||
{
|
||||
var dict = base.GetTranslationDictionary();
|
||||
|
||||
AddOrReplaceTranslation(dict, "Hilfepläne", "Bewilligungen");
|
||||
AddOrReplaceTranslation(dict, "Hilfeplan", "Bewilligung");
|
||||
AddOrReplaceTranslation(dict, "Teilnahme an Hilfeplankonferenz", "Teilnahme an BEW-Begutachtung");
|
||||
AddOrReplaceTranslation(dict, "Hilfeplan beantragt am", "Arbeitsaufnahme am");
|
||||
AddOrReplaceTranslation(dict, "Hilfeplan eingereicht am", "BRP eingereicht am");
|
||||
AddOrReplaceTranslation(dict, "Hilfeplankonferenz", "BEW-Begutachtung am");
|
||||
AddOrReplaceTranslation(dict, "Ort des Hilfeplangesprächs", "Ort der BEW-Begutachtung");
|
||||
|
||||
AddOrReplaceTranslation(dict, "Kostenträger", "Kostenübernahme");
|
||||
|
||||
AddOrReplaceTranslation(dict, "Klienten", "KlientInnen");
|
||||
AddOrReplaceTranslation(dict, "Mitarbeiter", "MitarbeiterIn");
|
||||
AddOrReplaceTranslation(dict, "MitarbeiterSingular", "MitarbeiterIn");
|
||||
AddOrReplaceTranslation(dict, "MitarbeiterPlural", "MitarbeiterInnen");
|
||||
|
||||
AddOrReplaceTranslation(dict, "FLS", "h");
|
||||
|
||||
AddOrReplaceTranslation(dict, "Hilfeplankonferenzen der nächsten zwei Wochen", "BEW-Begutachtungen");
|
||||
|
||||
return dict;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
14
Shared/Translation/ITranslator.cs
Normal file
14
Shared/Translation/ITranslator.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BS.Shared.Translation
|
||||
{
|
||||
public interface ITranslator
|
||||
{
|
||||
String Translate(String input);
|
||||
String Translate(String input, params Object[] args);
|
||||
}
|
||||
}
|
||||
80
Shared/Translation/Translator.cs
Normal file
80
Shared/Translation/Translator.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BS.Shared.Translation
|
||||
{
|
||||
public class Translator
|
||||
{
|
||||
private static Translator instance;
|
||||
|
||||
private static ITranslator Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance.translator;
|
||||
}
|
||||
}
|
||||
|
||||
public static String Translate(Enum enumValue)
|
||||
{
|
||||
if (enumValue == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Translate(enumValue.GetType().FullName + ".");// + EnumUtils.ToString(enumValue));
|
||||
}
|
||||
|
||||
public static String Translate(Enum enumValue, params Object[] args)
|
||||
{
|
||||
return Translate(enumValue.GetType().FullName + ".");// + EnumUtils.ToString(enumValue), args);
|
||||
}
|
||||
|
||||
public static String Translate(String input)
|
||||
{
|
||||
//if (input == "Mitarbeiter")
|
||||
//{
|
||||
// return "MitarbeiterIn";
|
||||
//}
|
||||
//if (input == "Klient")
|
||||
//{
|
||||
// return "KlientIn";
|
||||
//}
|
||||
//if (input == "Klienten")
|
||||
//{
|
||||
// return "KlientInnen";
|
||||
//}
|
||||
|
||||
////return input;
|
||||
//return "TRANSLATED";
|
||||
|
||||
if (instance != null)
|
||||
{
|
||||
// handle null instance in design mode
|
||||
return Instance.Translate(input);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
public static String Translate(String input, params Object[] args)
|
||||
{
|
||||
if (instance != null)
|
||||
{
|
||||
// handle null instance in design mode
|
||||
return Instance.Translate(input, args);
|
||||
}
|
||||
return String.Format(input, args);
|
||||
}
|
||||
|
||||
private readonly ITranslator translator;
|
||||
|
||||
public Translator(ITranslator translator)
|
||||
{
|
||||
this.translator = translator;
|
||||
instance = this;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user