Please briefly understand the following content before using this program,
Because Simplified Chinese has deleted many useful traditional characters,
If it is directly converted into traditional Chinese, there will be a problem of missing characters.
But the conversion of traditional Chinese into simplified Chinese does not have this problem.
Therefore, we recommend that you directly make a traditional Chinese version when making a Chinese translation.
Although Simplified Chinese is called "Simplified",
But it didn’t make Chinese easier to understand,
It is not friendly to users of traditional Chinese,
Please make independent translations for these two languages,
Use the following program to make this easy.
namespace Chinese
{
using System.Runtime.InteropServices;
public static class ChineseProgram
{
///
/// use "kernel32.dll" to convert
///
private const int LocaleSystemDefault = 0x0800;
private const int LcmapSimplifiedChinese = 0x02000000;
private const int LcmapTraditionalChinese = 0x04000000;
[DllImport("kernel32", CharSet = CharSet.Unicode, SetLastError = true)]
private static extern int LCMapString(int locale, int dwMapFlags, string lpSrcStr, int cchSrc,
[Out] string lpDestStr, int cchDest);
public static string ToSimplified(string source)
{
string target = new string(' ', source.Length);
int ret = LCMapString(LocaleSystemDefault, LcmapSimplifiedChinese, source, source.Length, target, source.Length);
return target;
}
public static string ToTraditional(string argSource)
{
var t = new string(' ', argSource.Length);
LCMapString(LocaleSystemDefault, LcmapTraditionalChinese, argSource, argSource.Length, t, argSource.Length);
return t;
}
}
}