Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .vs/NSModCreator/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
11 changes: 11 additions & 0 deletions .vs/NSModCreator/project-colors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Version": 1,
"ProjectMap": {
"5d354e3f-ea1a-4fcc-9228-fefa125bcfa8": {
"ProjectGuid": "5d354e3f-ea1a-4fcc-9228-fefa125bcfa8",
"DisplayName": "NSModCreator",
"ColorIndex": 0
}
},
"NextColorIndex": 1
}
Binary file added .vs/NSModCreator/v17/.futdcache.v1
Binary file not shown.
Binary file added .vs/NSModCreator/v17/.suo
Binary file not shown.
57 changes: 57 additions & 0 deletions NSModCreator/LocalizationAttachedPropertyHolder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using Avalonia;
using Avalonia.Controls;
using NSModCreator.Localizations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NSModCreator.Localizations
{
public class LocalizationAttachedPropertyHolder
{
public static AvaloniaProperty<string> UidProperty =
AvaloniaProperty.RegisterAttached<LocalizationAttachedPropertyHolder, AvaloniaObject, string>("Uid");

static LocalizationAttachedPropertyHolder()
{
TextBlock.TextProperty.Changed.Subscribe(next =>
{
var uid = GetUid((AvaloniaObject)next.Sender);
if (uid != null)
{
next.Sender.SetValue(TextBlock.TextProperty, AppResources.ResourceManager.GetString(uid.ToString()));
}
});

ContentControl.ContentProperty.Changed.Subscribe(next =>
{
var uid = GetUid((AvaloniaObject)next.Sender);
if (uid != null)
{
next.Sender.SetValue(ContentControl.ContentProperty, AppResources.ResourceManager.GetString(uid.ToString()));
}
});

TextBox.WatermarkProperty.Changed.Subscribe(next =>
{
var uid = GetUid((AvaloniaObject)next.Sender);
if (uid != null)
{
next.Sender.SetValue(TextBox.WatermarkProperty, AppResources.ResourceManager.GetString(uid.ToString()));
}
});
}

public static void SetUid(AvaloniaObject target, string value)
{
target.SetValue(UidProperty, value);
}

public static string GetUid(AvaloniaObject target)
{
return (string)target.GetValue(UidProperty);
}
}
}
324 changes: 324 additions & 0 deletions NSModCreator/Localizations/AppResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading