mirror of
https://github.com/libretro/MesenCE.git
synced 2026-11-10 03:02:05 -10:00
* Code: Add auto-formatting rules for C++ projects (clang-format) and enforce code style via "clang-format" and "dotnet format" * fix ui format warnings
30 lines
673 B
C#
30 lines
673 B
C#
using Avalonia.Markup.Xaml;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Mesen.Localization
|
|
{
|
|
public class TranslateExtension : MarkupExtension
|
|
{
|
|
public TranslateExtension(string key)
|
|
{
|
|
this.Key = key;
|
|
}
|
|
|
|
public string Key { get; set; }
|
|
|
|
public override object ProvideValue(IServiceProvider serviceProvider)
|
|
{
|
|
Type? contextType = null;
|
|
if(serviceProvider.GetType().GenericTypeArguments.Length > 0) {
|
|
contextType = serviceProvider.GetType().GenericTypeArguments[0];
|
|
}
|
|
|
|
return ResourceHelper.GetViewLabel(contextType?.Name ?? "unknown", this.Key);
|
|
}
|
|
}
|
|
}
|