是否有 Unicode 字符名称的标准化翻译?

vsc*_*ech 5 unicode translation internationalization

Unicode 标准中的每个代码点都有一个唯一的英文名称。我需要将这些名称(代码点的一小部分)翻译成德语、法语、日语等语言……我确实可以联系专业翻译人员,因此当然可以将这些名称一一翻译,但是结果不一定能很好地体现 Unicode 标准的意图。我想知道 Unicode 委员会是否已经努力标准化英语以外的语言的代码点名称,以便我可以简单地参考他们的翻译?我在 unicode.org 上找不到除了英文以外的任何内容,但我仍然希望我错过了一些东西。提前致谢!

Jos*_*efZ 1

.NET/PowerShell示例:[Microsofts.CharMap.UName]::Get(\'\xc4\x8d\')

\n\n

Windows 操作系统本地化name中保存了(至少)本地化的 Unicode 属性。直接使用以下脚本,或者从中获取灵感:getuname.dll

\n\n
<#\nOrigin   by: http://poshcode.org/5234\nImproved by: /sf/users/240758311/\n\nUse this like this: "\xc3\xa1b\xc4\x8d",([char]\'x\'),0xBF | Get-CharInfo\n\nActivate dot-sourced like this (apply a real path instead of .\\):\n\n. .\\_get-CharInfo_1.1.ps1\n\n#>\n\nSet-StrictMode -Version latest\n\nAdd-Type -Name UName -Namespace Microsofts.CharMap -MemberDefinition $(\n    switch ("$([System.Environment]::SystemDirectory -replace \n                \'\\\\\', \'\\\\\')\\\\getuname.dll") {\n    {Test-Path -LiteralPath $_ -PathType Leaf} {@"\n[DllImport("${_}", ExactSpelling=true, SetLastError=true)]\nprivate static extern int GetUName(ushort wCharCode, \n    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder buf);\n\npublic static string Get(char ch) {\n    var sb = new System.Text.StringBuilder(300);\n    UName.GetUName(ch, sb);\n    return sb.ToString();\n}\n"@\n    }\n    default {\'public static string Get(char ch) { return "???"; }\'}\n    })\n\nfunction Get-CharInfo {\n    [CmdletBinding()]\n    [OutputType([System.Management.Automation.PSCustomObject],[System.Array])]\n    param(\n        [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]\n        $InputObject\n    )\n    begin {\n        function out {\n            param(\n                [Parameter(Position=0, Mandatory=$true )] $ch,\n                [Parameter(Position=1, Mandatory=$false)]$nil=\'\'\n                 )\n            if (0 -le $ch -and 0xFFFF -ge $ch) {\n                [pscustomobject]@{\n                    Char = [char]$ch\n                    CodePoint = \'U+{0:X4}\' -f $ch\n                    Category = [System.Globalization.CharUnicodeInfo]::GetUnicodeCategory($ch)\n                    Description = [Microsofts.CharMap.UName]::Get($ch)\n                }\n            } elseif (0 -le $ch -and 0x10FFFF -ge $ch) {\n                $s = [char]::ConvertFromUtf32($ch)\n                [pscustomobject]@{\n                    Char = $s\n                    CodePoint = \'U+{0:X}\' -f $ch\n                    Category = [System.Globalization.CharUnicodeInfo]::GetUnicodeCategory($s, 0)\n                    Description = \'???\' + $nil\n                }\n            } else {\n                Write-Warning (\'Character U+{0:X} is out of range\' -f $ch)\n            }\n        }\n    }\n    process {\n        if ($PSBoundParameters[\'Verbose\']) {\n            Write-Warning "InputObject type = $($InputObject.GetType().Name)"}\n        if ($null -cne ($InputObject -as [char])) {\n            #Write-Verbose "A $([char]$InputObject) InputObject character"\n            out $([int][char]$InputObject) \'\'\n        } elseif ($InputObject -isnot [string] -and $null -cne ($InputObject -as [int])) {\n            #Write-Verbose "B $InputObject InputObject"\n            out $([int]$InputObject) \'\'\n        } else {\n            $InputObject = [string]$InputObject\n            #Write-Verbose "C $InputObject InputObject.Length $($InputObject.Length)"\n            for ($i = 0; $i -lt $InputObject.Length; ++$i) {\n                if (  [char]::IsHighSurrogate($InputObject[$i]) -and \n                      (1+$i) -lt $InputObject.Length -and \n                      [char]::IsLowSurrogate($InputObject[$i+1])) {\n                    $aux = \' 0x{0:x4},0x{1:x4}\' -f [int]$InputObject[$i], \n                                                   [int]$InputObject[$i+1]\n                    Write-Verbose "surrogate pair $aux at position $i" \n                    out $([char]::ConvertToUtf32($InputObject[$i], $InputObject[1+$i])) $aux\n                    $i++\n                } else {\n                    out $([int][char]$InputObject[$i]) \'\'\n                }\n            }\n        }\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

例子

\n\n
<#\nOrigin   by: http://poshcode.org/5234\nImproved by: https://stackoverflow.com/users/3439404/josefz\n\nUse this like this: "\xc3\xa1b\xc4\x8d",([char]\'x\'),0xBF | Get-CharInfo\n\nActivate dot-sourced like this (apply a real path instead of .\\):\n\n. .\\_get-CharInfo_1.1.ps1\n\n#>\n\nSet-StrictMode -Version latest\n\nAdd-Type -Name UName -Namespace Microsofts.CharMap -MemberDefinition $(\n    switch ("$([System.Environment]::SystemDirectory -replace \n                \'\\\\\', \'\\\\\')\\\\getuname.dll") {\n    {Test-Path -LiteralPath $_ -PathType Leaf} {@"\n[DllImport("${_}", ExactSpelling=true, SetLastError=true)]\nprivate static extern int GetUName(ushort wCharCode, \n    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder buf);\n\npublic static string Get(char ch) {\n    var sb = new System.Text.StringBuilder(300);\n    UName.GetUName(ch, sb);\n    return sb.ToString();\n}\n"@\n    }\n    default {\'public static string Get(char ch) { return "???"; }\'}\n    })\n\nfunction Get-CharInfo {\n    [CmdletBinding()]\n    [OutputType([System.Management.Automation.PSCustomObject],[System.Array])]\n    param(\n        [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]\n        $InputObject\n    )\n    begin {\n        function out {\n            param(\n                [Parameter(Position=0, Mandatory=$true )] $ch,\n                [Parameter(Position=1, Mandatory=$false)]$nil=\'\'\n                 )\n            if (0 -le $ch -and 0xFFFF -ge $ch) {\n                [pscustomobject]@{\n                    Char = [char]$ch\n                    CodePoint = \'U+{0:X4}\' -f $ch\n                    Category = [System.Globalization.CharUnicodeInfo]::GetUnicodeCategory($ch)\n                    Description = [Microsofts.CharMap.UName]::Get($ch)\n                }\n            } elseif (0 -le $ch -and 0x10FFFF -ge $ch) {\n                $s = [char]::ConvertFromUtf32($ch)\n                [pscustomobject]@{\n                    Char = $s\n                    CodePoint = \'U+{0:X}\' -f $ch\n                    Category = [System.Globalization.CharUnicodeInfo]::GetUnicodeCategory($s, 0)\n                    Description = \'???\' + $nil\n                }\n            } else {\n                Write-Warning (\'Character U+{0:X} is out of range\' -f $ch)\n            }\n        }\n    }\n    process {\n        if ($PSBoundParameters[\'Verbose\']) {\n            Write-Warning "InputObject type = $($InputObject.GetType().Name)"}\n        if ($null -cne ($InputObject -as [char])) {\n            #Write-Verbose "A $([char]$InputObject) InputObject character"\n            out $([int][char]$InputObject) \'\'\n        } elseif ($InputObject -isnot [string] -and $null -cne ($InputObject -as [int])) {\n            #Write-Verbose "B $InputObject InputObject"\n            out $([int]$InputObject) \'\'\n        } else {\n            $InputObject = [string]$InputObject\n            #Write-Verbose "C $InputObject InputObject.Length $($InputObject.Length)"\n            for ($i = 0; $i -lt $InputObject.Length; ++$i) {\n                if (  [char]::IsHighSurrogate($InputObject[$i]) -and \n                      (1+$i) -lt $InputObject.Length -and \n                      [char]::IsLowSurrogate($InputObject[$i+1])) {\n                    $aux = \' 0x{0:x4},0x{1:x4}\' -f [int]$InputObject[$i], \n                                                   [int]$InputObject[$i+1]\n                    Write-Verbose "surrogate pair $aux at position $i" \n                    out $([char]::ConvertToUtf32($InputObject[$i], $InputObject[1+$i])) $aux\n                    $i++\n                } else {\n                    out $([int][char]$InputObject[$i]) \'\'\n                }\n            }\n        }\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

请注意,后者(半本地化)输出来自以下代码(在本地用户下在同一台计算机上运行):

\n\n
"\xc3\xa1b\xc4\x8d",([char]\'x\'),0xBF | Get-CharInfo | Out-File .\\DataFiles\\getcharinfoczech.txt\n
Run Code Online (Sandbox Code Playgroud)\n