43 lines
786 B
C#
43 lines
786 B
C#
using Godot;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Godot.Collections;
|
|
|
|
namespace Rokojori
|
|
{
|
|
[Tool]
|
|
[GlobalClass]
|
|
public partial class LocaleText:LocalizedString
|
|
{
|
|
[Export(PropertyHint.MultilineText)]
|
|
public string en;
|
|
|
|
[ExportGroup("Translations")]
|
|
[Export]
|
|
public LocaleTextEntry[] entries;
|
|
|
|
[ExportGroup("Context")]
|
|
[Export(PropertyHint.MultilineText)]
|
|
public string context;
|
|
|
|
|
|
public override string GetLocalizedString( LocaleCode localeCode )
|
|
{
|
|
if ( localeCode == LocaleCode.EN )
|
|
{
|
|
return en;
|
|
}
|
|
|
|
var entry = Arrays.Find( entries, e => e.code == localeCode );
|
|
|
|
if ( entry != null )
|
|
{
|
|
return entry.content;
|
|
}
|
|
|
|
return en;
|
|
|
|
}
|
|
|
|
}
|
|
} |