是否有Unicode字符名称的标准化翻译?
Unicode标准中的每个代码点都附带一个唯一的英文名称。我需要将这些名称(一小部分代码点)翻译成德语、法语、日语等语言。。。我可以接触到专业的翻译人员,因此当然可以将这些名称逐一翻译,但结果不一定能很好地体现Unicode标准的意图。我想知道Unicode委员会是否已经做出努力来标准化英语以外语言的代码点名称,以便我可以简单地参考它们的翻译?我在unicode.org上除了英语什么都找不到,但我还是希望我错过了一些东西。提前谢谢是否有Unicode字符名称的标准化翻译?,unicode,internationalization,translation,Unicode,Internationalization,Translation,Unicode标准中的每个代码点都附带一个唯一的英文名称。我需要将这些名称(一小部分代码点)翻译成德语、法语、日语等语言。。。我可以接触到专业的翻译人员,因此当然可以将这些名称逐一翻译,但结果不一定能很好地体现Unicode标准的意图。我想知道Unicode委员会是否已经做出努力来标准化英语以外语言的代码点名称,以便我可以简单地参考它们的翻译?我在unicode.org上除了英语什么都找不到,但我还是希望我错过了一些东西。提前谢谢 .NET/PowerShell示例:[Microsofts.Ch
.NET
/PowerShell示例:[Microsofts.CharMap.UName]::Get('č')
Windows OS:在本地化库getuname.dll
中保存了本地化的Unicode属性(name
)。直接使用以下脚本,或从中获得灵感:
<#
Origin by: http://poshcode.org/5234
Improved by: https://stackoverflow.com/users/3439404/josefz
Use this like this: "ábč",([char]'x'),0xBF | Get-CharInfo
Activate dot-sourced like this (apply a real path instead of .\):
. .\_get-CharInfo_1.1.ps1
#>
Set-StrictMode -Version latest
Add-Type -Name UName -Namespace Microsofts.CharMap -MemberDefinition $(
switch ("$([System.Environment]::SystemDirectory -replace
'\\', '\\')\\getuname.dll") {
{Test-Path -LiteralPath $_ -PathType Leaf} {@"
[DllImport("${_}", ExactSpelling=true, SetLastError=true)]
private static extern int GetUName(ushort wCharCode,
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder buf);
public static string Get(char ch) {
var sb = new System.Text.StringBuilder(300);
UName.GetUName(ch, sb);
return sb.ToString();
}
"@
}
default {'public static string Get(char ch) { return "???"; }'}
})
function Get-CharInfo {
[CmdletBinding()]
[OutputType([System.Management.Automation.PSCustomObject],[System.Array])]
param(
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]
$InputObject
)
begin {
function out {
param(
[Parameter(Position=0, Mandatory=$true )] $ch,
[Parameter(Position=1, Mandatory=$false)]$nil=''
)
if (0 -le $ch -and 0xFFFF -ge $ch) {
[pscustomobject]@{
Char = [char]$ch
CodePoint = 'U+{0:X4}' -f $ch
Category = [System.Globalization.CharUnicodeInfo]::GetUnicodeCategory($ch)
Description = [Microsofts.CharMap.UName]::Get($ch)
}
} elseif (0 -le $ch -and 0x10FFFF -ge $ch) {
$s = [char]::ConvertFromUtf32($ch)
[pscustomobject]@{
Char = $s
CodePoint = 'U+{0:X}' -f $ch
Category = [System.Globalization.CharUnicodeInfo]::GetUnicodeCategory($s, 0)
Description = '???' + $nil
}
} else {
Write-Warning ('Character U+{0:X} is out of range' -f $ch)
}
}
}
process {
if ($PSBoundParameters['Verbose']) {
Write-Warning "InputObject type = $($InputObject.GetType().Name)"}
if ($null -cne ($InputObject -as [char])) {
#Write-Verbose "A $([char]$InputObject) InputObject character"
out $([int][char]$InputObject) ''
} elseif ($InputObject -isnot [string] -and $null -cne ($InputObject -as [int])) {
#Write-Verbose "B $InputObject InputObject"
out $([int]$InputObject) ''
} else {
$InputObject = [string]$InputObject
#Write-Verbose "C $InputObject InputObject.Length $($InputObject.Length)"
for ($i = 0; $i -lt $InputObject.Length; ++$i) {
if ( [char]::IsHighSurrogate($InputObject[$i]) -and
(1+$i) -lt $InputObject.Length -and
[char]::IsLowSurrogate($InputObject[$i+1])) {
$aux = ' 0x{0:x4},0x{1:x4}' -f [int]$InputObject[$i],
[int]$InputObject[$i+1]
Write-Verbose "surrogate pair $aux at position $i"
out $([char]::ConvertToUtf32($InputObject[$i], $InputObject[1+$i])) $aux
$i++
} else {
out $([int][char]$InputObject[$i]) ''
}
}
}
}
}
请注意,后一个(半本地化)输出来自以下代码(在同一台计算机上的本地化用户下运行):
"ábč",([char]'x'),0xBF | Get-CharInfo | Out-File .\DataFiles\getcharinfoczech.txt