64 lines
2.7 KiB
C#
64 lines
2.7 KiB
C#
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
|
|
// <auto-generated />
|
|
#nullable enable
|
|
|
|
namespace PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0;
|
|
|
|
public interface II18nImports {
|
|
|
|
public static unsafe string Translate(string key, global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ICommonImports.Locale locale)
|
|
{
|
|
var cleanups = new global::System.Collections.Generic.List<global::System.Action>();
|
|
|
|
var utf8Bytes = global::System.Text.Encoding.UTF8.GetBytes(key);
|
|
var length = utf8Bytes.Length;
|
|
var gcHandle = global::System.Runtime.InteropServices.GCHandle.Alloc(utf8Bytes, global::System.Runtime.InteropServices.GCHandleType.Pinned);
|
|
var strPtr = gcHandle.AddrOfPinnedObject();
|
|
|
|
cleanups.Add(()=> gcHandle.Free());
|
|
|
|
var retArea = stackalloc uint[3];
|
|
var ptr = (nint)MemoryHelper.AlignStackPtr(retArea, 4);
|
|
I18nImportsInterop.TranslateWasmInterop.wasmImportTranslate(strPtr.ToInt32(), length, (int)locale, ptr);
|
|
|
|
var str = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span<nint>((void*)((byte*)ptr + 0), 1)[0], new global::System.Span<int>((void*)((byte*)ptr + 4), 1)[0]);
|
|
if (new global::System.Span<int>((void*)((byte*)ptr + 4), 1)[0] > 0) {
|
|
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span<nint>((void*)((byte*)ptr + 0), 1)[0]);
|
|
}
|
|
|
|
foreach (var cleanup in cleanups)
|
|
{
|
|
cleanup();
|
|
}
|
|
return str;
|
|
|
|
}
|
|
|
|
public static unsafe void LoadTranslations(string @namespace, string json, global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ICommonImports.Locale locale)
|
|
{
|
|
var cleanups = new global::System.Collections.Generic.List<global::System.Action>();
|
|
|
|
var utf8Bytes = global::System.Text.Encoding.UTF8.GetBytes(@namespace);
|
|
var length = utf8Bytes.Length;
|
|
var gcHandle = global::System.Runtime.InteropServices.GCHandle.Alloc(utf8Bytes, global::System.Runtime.InteropServices.GCHandleType.Pinned);
|
|
var strPtr = gcHandle.AddrOfPinnedObject();
|
|
|
|
cleanups.Add(()=> gcHandle.Free());
|
|
|
|
var utf8Bytes1 = global::System.Text.Encoding.UTF8.GetBytes(json);
|
|
var length2 = utf8Bytes1.Length;
|
|
var gcHandle3 = global::System.Runtime.InteropServices.GCHandle.Alloc(utf8Bytes1, global::System.Runtime.InteropServices.GCHandleType.Pinned);
|
|
var strPtr0 = gcHandle3.AddrOfPinnedObject();
|
|
|
|
cleanups.Add(()=> gcHandle3.Free());
|
|
I18nImportsInterop.LoadTranslationsWasmInterop.wasmImportLoadTranslations(strPtr.ToInt32(), length, strPtr0.ToInt32(), length2, (int)locale);
|
|
|
|
foreach (var cleanup in cleanups)
|
|
{
|
|
cleanup();
|
|
}
|
|
|
|
}
|
|
|
|
}
|