现在,这项工作已通过创建音译功能得到补充,该功能将一串俄语文本转换为拉丁字母的音译。此外,如果字符串包含拉丁字符,则不会翻译它们,也就是说,可以将字符和单词的混合字符串作为参数传递给函数。
字符转换是根据GOST 7.79-2000(系统B)执行的。不考虑名称音译的特殊规则,除了以“ IE”和“ OY”以“ IJ”结尾的特殊尾缀“ LE”的特殊转换。
以下是完整的功能代码:
# Function Translite of Russian characters for sending in Telegram
# by Sertik 16/09/2020
# usage [$FuncTransliteToTele " String .,!+"]
:global FuncTransliteToTele do={
:global string; :set $string $1;
# table of the codes of Russian letters Translite
:local rsimv [:toarray {""="A"; ""="B"; ""="V"; ""="G"; ""="D"; ""="E"; ""="ZH"; ""="Z"; ""="I"; ""="J"; ""="K"; ""="L"; ""="M"; ""="N"; ""="O"; ""="P"; ""="R"; ""="S"; ""="T"; ""="U"; ""="F"; ""="KH"; ""="C"; ""="CH"; ""="SH"; ""="SCH"; ""="``"; ""="Y`"; ""="`"; ""="E`"; ""="JU"; ""="YA"; ""="a"; ""="b"; ""="v"; ""="g"; ""="d"; ""="e"; ""="zh"; ""="z"; ""="i"; ""="j"; ""="k"; ""="l"; ""="m"; ""="n"; ""="o"; ""="p"; ""="r"; ""="s"; ""="t"; ""="u"; ""="f"; ""="kh"; ""="c"; ""="ch"; ""="sh"; ""="sch"; ""="``"; ""="y`"; ""="`"; ""="e`"; ""="ju"; ""="ya"; ""="Yo"; ""="yo"; "№"="#"}]
# encoding of the symbols and ssembly line
:local StrTele ""; :local code "";
:for i from=0 to=([:len $string]-1) do={:local keys [:pick $string $i (1+$i)];
:local key ($rsimv->$keys); if ([:len $key]!=0) do={:set $code ($rsimv->$keys);} else={:set $code $keys};
:if (($keys="") and ([:pick $string ($i+1) (2+$i)]="")) do={:set $code "I"; :set $i ($i+1)}
:if (($keys="") and ([:pick $string ($i+1) (2+$i)]="")) do={:set $code "i"; :set $i ($i+1)}
:if (($keys="") and ([:pick $string ($i+1) (2+$i)]="")) do={:set $code "I"; :set $i ($i+1)}
:if (($keys="") and ([:pick $string ($i+1) (2+$i)]="")) do={:set $code "i"; :set $i ($i+1)}
:if (($keys="") and ([:pick $string ($i+1) (2+$i)]="")) do={:set $code "I"; :set $i ($i+1)}
:if (($keys="") and ([:pick $string ($i+1) (2+$i)]="")) do={:set $code "i"; :set $i ($i+1)}
:if (($keys="") and ([:pick $string ($i+1) (2+$i)]="")) do={:set $code "i"; :set $i ($i+1)}
:if (($keys="") and ([:pick $string ($i+1) (2+$i)]="")) do={:set $code "I"; :set $i ($i+1)}
:set $StrTele ("$StrTele"."$code")}
:set $string $StrTele
:return $string;
}
这是它如何工作的示例:
:local string [$FuncTransliteToTele " ! - Russian alfabit Telegramm. "]
:log warning $string
日志 输出:Privet ot Mikrotik!Rabotaet funksiya-konverter俄语-alfabit dliya Telegramm。扎亚克·贝利(Zayac Beliy)。
用户可以根据自己使用的标准对音译表进行校正。我希望这对某人有用。现在,您可以从此处使用我的转换器功能转换为UTF-8代码,并通过音译,将俄语消息发送给Telegram感到很平静。