<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ro">
	<id>https://enciclopedia.md/index.php?action=history&amp;feed=atom&amp;title=Modul%3ATransliteration</id>
	<title>Modul:Transliteration - Revizia istoricului</title>
	<link rel="self" type="application/atom+xml" href="https://enciclopedia.md/index.php?action=history&amp;feed=atom&amp;title=Modul%3ATransliteration"/>
	<link rel="alternate" type="text/html" href="https://enciclopedia.md/index.php?title=Modul:Transliteration&amp;action=history"/>
	<updated>2026-06-06T01:55:28Z</updated>
	<subtitle>Istoricul versiunilor pentru această pagină din wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://enciclopedia.md/index.php?title=Modul:Transliteration&amp;diff=345&amp;oldid=prev</id>
		<title>Sergiu: Pagină nouă: local p = {} local getArgs = require(&#039;Modul:Arguments&#039;).getArgs local transliterationMaps = mw.loadData(&#039;Modul:Transliteration/langdata&#039;)  local function isTransliterationSupported(langCode) 	if transliterationMaps[langCode] then return true end 	return false end p.isTransliterationSupported = isTransliterationSupported  local function postProcess(str)  	local chars = {} 	local idx = 1 	while idx &lt;= mw.ustring.len(str) do 		local crtChar = mw.ustring.sub(str, idx, idx) 		if c...</title>
		<link rel="alternate" type="text/html" href="https://enciclopedia.md/index.php?title=Modul:Transliteration&amp;diff=345&amp;oldid=prev"/>
		<updated>2024-07-14T20:21:18Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: local p = {} local getArgs = require(&amp;#039;Modul:Arguments&amp;#039;).getArgs local transliterationMaps = mw.loadData(&amp;#039;Modul:Transliteration/langdata&amp;#039;)  local function isTransliterationSupported(langCode) 	if transliterationMaps[langCode] then return true end 	return false end p.isTransliterationSupported = isTransliterationSupported  local function postProcess(str)  	local chars = {} 	local idx = 1 	while idx &amp;lt;= mw.ustring.len(str) do 		local crtChar = mw.ustring.sub(str, idx, idx) 		if c...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Pagină nouă&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
local getArgs = require(&amp;#039;Modul:Arguments&amp;#039;).getArgs&lt;br /&gt;
local transliterationMaps = mw.loadData(&amp;#039;Modul:Transliteration/langdata&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local function isTransliterationSupported(langCode)&lt;br /&gt;
	if transliterationMaps[langCode] then return true end&lt;br /&gt;
	return false&lt;br /&gt;
end&lt;br /&gt;
p.isTransliterationSupported = isTransliterationSupported&lt;br /&gt;
&lt;br /&gt;
local function postProcess(str) &lt;br /&gt;
	local chars = {}&lt;br /&gt;
	local idx = 1&lt;br /&gt;
	while idx &amp;lt;= mw.ustring.len(str) do&lt;br /&gt;
		local crtChar = mw.ustring.sub(str, idx, idx)&lt;br /&gt;
		if crtChar == &amp;#039;\226\140\166&amp;#039; then &lt;br /&gt;
			idx = idx + 1&lt;br /&gt;
		elseif crtChar == &amp;#039;\226\140\171&amp;#039; and #table &amp;gt; 1 then&lt;br /&gt;
			table.remove(chars, #chars)&lt;br /&gt;
		else&lt;br /&gt;
			table.insert(chars, crtChar)&lt;br /&gt;
		end&lt;br /&gt;
		idx = idx + 1&lt;br /&gt;
	end&lt;br /&gt;
	return table.concat(chars)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function applyConversionRule(conversionRule, crtChar, prevChar, nextChar)&lt;br /&gt;
	if not conversionRule then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	if type(conversionRule) == &amp;#039;string&amp;#039; then&lt;br /&gt;
		return conversionRule&lt;br /&gt;
	end&lt;br /&gt;
	if type(conversionRule) == &amp;#039;table&amp;#039; then&lt;br /&gt;
		return prevChar and conversionRule[&amp;#039;bh&amp;#039;] and applyConversionRule(conversionRule[&amp;#039;bh&amp;#039;][prevChar], crtChar, prevChar, nextChar)&lt;br /&gt;
			or nextChar and conversionRule[&amp;#039;ah&amp;#039;] and applyConversionRule(conversionRule[&amp;#039;ah&amp;#039;][nextChar], crtChar, prevChar, nextChar)&lt;br /&gt;
			or conversionRule[&amp;#039;def&amp;#039;]&lt;br /&gt;
	end&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function transliterate(text, langCode)&lt;br /&gt;
	if text == nil then return nil end&lt;br /&gt;
	local map = transliterationMaps[langCode]&lt;br /&gt;
	local lang = mw.language.new(langCode)&lt;br /&gt;
	if not map then &lt;br /&gt;
		error(&amp;#039;Transliteration from language &amp;#039; .. langCode .. &amp;#039; not supported&amp;#039;, 2)&lt;br /&gt;
	end&lt;br /&gt;
	local out = &amp;#039;&amp;#039;&lt;br /&gt;
	for strIdx = 1,mw.ustring.len(text) do&lt;br /&gt;
		local crtChar = mw.ustring.sub(text, strIdx, strIdx)&lt;br /&gt;
		local prevChar = strIdx &amp;gt; 1 and lang:lc(mw.ustring.sub(text, strIdx - 1, strIdx - 1)) or &amp;#039;&amp;#039;&lt;br /&gt;
		local nextChar = strIdx &amp;lt; mw.ustring.len(text) and lang:lc(mw.ustring.sub(text, strIdx + 1, strIdx + 1)) or &amp;#039;&amp;#039;&lt;br /&gt;
		&lt;br /&gt;
		local convertedChar = applyConversionRule(map[crtChar], crtChar, prevChar, nextChar)&lt;br /&gt;
		if not convertedChar then&lt;br /&gt;
			local lcCrtChar = lang:lc(crtChar)&lt;br /&gt;
			local ucConvertedChar = applyConversionRule(map[lcCrtChar], lcCrtChar, prevChar, nextChar)&lt;br /&gt;
			convertedChar = ucConvertedChar and lang:ucfirst(ucConvertedChar)&lt;br /&gt;
		end&lt;br /&gt;
		out = out .. (convertedChar or crtChar)&lt;br /&gt;
	end&lt;br /&gt;
	return postProcess(out)&lt;br /&gt;
end&lt;br /&gt;
p.transliterate = transliterate&lt;br /&gt;
&lt;br /&gt;
local function transliterateFromFrame(frame)&lt;br /&gt;
	local args = getArgs(frame)&lt;br /&gt;
	local text = args.text or args[1]&lt;br /&gt;
	local lang = args.lang or args[2]&lt;br /&gt;
	return transliterate(text, lang)&lt;br /&gt;
end&lt;br /&gt;
p.transliterateFromFrame = transliterateFromFrame&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Sergiu</name></author>
	</entry>
</feed>