mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-24 19:45:37 -05:00
Merge pull request #939 from oocytanb/fix/m17n_value_caching
Fix incorrect value caching of M17N
This commit is contained in:
@@ -61,7 +61,7 @@ namespace UniGLTF.M17N
|
||||
{
|
||||
var match = GetAttribute(value, language);
|
||||
// Attribute。無かったら enum の ToString
|
||||
map.Add(value, match != null ? match.Message : key.ToString());
|
||||
map.Add(value, match != null ? match.Message : value.ToString());
|
||||
}
|
||||
|
||||
s_cache.Add(language, map);
|
||||
|
||||
29
Assets/UniGLTF/Tests/UniGLTF/M17NTest.cs
Normal file
29
Assets/UniGLTF/Tests/UniGLTF/M17NTest.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using NUnit.Framework;
|
||||
using UniGLTF.M17N;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
public class M17NTest
|
||||
{
|
||||
enum M17NTestEnum
|
||||
{
|
||||
Foo,
|
||||
Bar,
|
||||
Baz,
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SimpleMsgTest()
|
||||
{
|
||||
Assert.AreEqual("Foo", M17NTestEnum.Foo.Msg());
|
||||
Assert.AreEqual("Bar", M17NTestEnum.Bar.Msg());
|
||||
Assert.AreEqual("Baz", M17NTestEnum.Baz.Msg());
|
||||
|
||||
// test caching
|
||||
Assert.AreEqual("Foo", M17NTestEnum.Foo.Msg());
|
||||
Assert.AreEqual("Bar", M17NTestEnum.Bar.Msg());
|
||||
Assert.AreEqual("Baz", M17NTestEnum.Baz.Msg());
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/UniGLTF/Tests/UniGLTF/M17NTest.cs.meta
Normal file
11
Assets/UniGLTF/Tests/UniGLTF/M17NTest.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e993fe746592bab4abe41c880b81555a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user