Lompat ke isi

Modul:Java-translit

Dari Wikikamus bahasa Indonesia, kamus bebas




(from w:jv:Dhiskusi_Panganggo:Bennylin/Narayam)


(from w:jv:Dhiskusi:Joko_Widodo)

  • [[꧋ꦥꦚ꧀ꦗꦼꦤꦼꦁꦔꦤ꧀ꦤꦶꦥꦸꦤ꧀​ꦩꦶꦪꦺꦴꦱ꧀​ꦏꦤ꧀ꦛꦶ​ꦲꦱ꧀ꦩ​ꦲꦱ꧀ꦭꦶ​ꦗꦏ​ꦮꦶꦢꦢ꧉ꦲꦤꦔꦶꦁ​ꦤꦭꦶꦏ​ꦠꦏ꧀ꦱꦶꦃ​ꦲꦏ꧀ꦠꦶꦥ꦳꧀​ꦲꦶꦁ​ꦗꦒꦢ꧀​ꦧꦶꦱ꧀ꦤꦶꦱ꧀​ꦩꦺꦧꦼꦭ꧀​ꦭꦤ꧀​ꦏꦒꦸꦁꦔꦤ꧀​ꦠꦶꦪꦁ​ꦲꦶꦁꦏꦁ​ꦠꦸꦩ꧀ꦧꦱ꧀​ꦱꦏꦶꦁ​ꦦꦿꦚ꧀ꦕꦶꦱ꧀꧈ꦠꦶꦪꦁ​ꦦꦿꦚ꧀ꦕꦶꦱ꧀​ꦩꦼꦤꦶꦏ​ꦔꦿꦲꦺꦴꦱ꧀​ꦧꦶꦔꦸꦁ꧈ꦲꦩꦂꦒꦶ​ꦤꦭꦶꦏ​ꦠꦸꦩ꧀ꦧꦱ꧀​ꦲꦶꦁ​ꦗꦼꦥꦫ꧈ꦱꦼꦩꦫꦁ꧈​ꦭꦤ꧀​ꦯꦸꦫꦧꦪ​ꦠꦤ꧀ꦱꦃ​ꦏꦼꦥꦁꦒꦶꦃ​ꦏꦭꦶꦪꦤ꧀​ꦠꦶꦪꦁ​ꦲꦶꦁꦏꦁ​ꦲꦱ꧀ꦩꦤꦶꦥꦸꦤ꧀​ꦗꦏ꧉ꦤꦭꦶꦏ​ꦏꦼꦥꦁꦒꦶꦃ​ꦏꦭꦶꦪꦤ꧀​ꦗꦏ​ꦮꦶꦢꦢ​ꦲꦶꦁ​ꦯꦭ꧈​ꦏꦁꦒꦺ​ꦩ꧀ꦧꦺꦤ꧀ꦠꦼꦤ꧀ꦤꦏꦼꦤ꧀​ꦱꦏꦶꦁ​ꦗꦏ​ꦗꦏ​ꦲꦶꦁꦏꦁ​ꦱꦤꦺꦱ꧀꧈​ꦠꦶꦪꦁ​ꦦꦿꦚ꧀ꦕꦶꦱ꧀​ꦏꦭꦮꦲꦸ​ꦥꦫꦶꦁ​ꦠꦶꦩ꧀ꦧꦭꦤ꧀​ꦗꦏꦮꦶ꧉#bahasa Jawa|꧋ꦥꦚ꧀ꦗꦼꦤꦼꦁꦔꦤ꧀ꦤꦶꦥꦸꦤ꧀​ꦩꦶꦪꦺꦴꦱ꧀​ꦏꦤ꧀ꦛꦶ​ꦲꦱ꧀ꦩ​ꦲꦱ꧀ꦭꦶ​ꦗꦏ​ꦮꦶꦢꦢ꧉ꦲꦤꦔꦶꦁ​ꦤꦭꦶꦏ​ꦠꦏ꧀ꦱꦶꦃ​ꦲꦏ꧀ꦠꦶꦥ꦳꧀​ꦲꦶꦁ​ꦗꦒꦢ꧀​ꦧꦶꦱ꧀ꦤꦶꦱ꧀​ꦩꦺꦧꦼꦭ꧀​ꦭꦤ꧀​ꦏꦒꦸꦁꦔꦤ꧀​ꦠꦶꦪꦁ​ꦲꦶꦁꦏꦁ​ꦠꦸꦩ꧀ꦧꦱ꧀​ꦱꦏꦶꦁ​ꦦꦿꦚ꧀ꦕꦶꦱ꧀꧈ꦠꦶꦪꦁ​ꦦꦿꦚ꧀ꦕꦶꦱ꧀​ꦩꦼꦤꦶꦏ​ꦔꦿꦲꦺꦴꦱ꧀​ꦧꦶꦔꦸꦁ꧈ꦲꦩꦂꦒꦶ​ꦤꦭꦶꦏ​ꦠꦸꦩ꧀ꦧꦱ꧀​ꦲꦶꦁ​ꦗꦼꦥꦫ꧈ꦱꦼꦩꦫꦁ꧈​ꦭꦤ꧀​ꦯꦸꦫꦧꦪ​ꦠꦤ꧀ꦱꦃ​ꦏꦼꦥꦁꦒꦶꦃ​ꦏꦭꦶꦪꦤ꧀​ꦠꦶꦪꦁ​ꦲꦶꦁꦏꦁ​ꦲꦱ꧀ꦩꦤꦶꦥꦸꦤ꧀​ꦗꦏ꧉ꦤꦭꦶꦏ​ꦏꦼꦥꦁꦒꦶꦃ​ꦏꦭꦶꦪꦤ꧀​ꦗꦏ​ꦮꦶꦢꦢ​ꦲꦶꦁ​ꦯꦭ꧈​ꦏꦁꦒꦺ​ꦩ꧀ꦧꦺꦤ꧀ꦠꦼꦤ꧀ꦤꦏꦼꦤ꧀​ꦱꦏꦶꦁ​ꦗꦏ​ꦗꦏ​ꦲꦶꦁꦏꦁ​ꦱꦤꦺꦱ꧀꧈​ꦠꦶꦪꦁ​ꦦꦿꦚ꧀ꦕꦶꦱ꧀​ꦏꦭꦮꦲꦸ​ꦥꦫꦶꦁ​ꦠꦶꦩ꧀ꦧꦭꦤ꧀​ꦗꦏꦮꦶ꧉]] ([[://panjenengngannipun​miyos​kanthi​hasma​hasli​jaka​widada.hananging​nalika​taksih​haktif​hing​jagad​bisnis​mébel​lan​kagungngan​tiyang​hingkang​tumbas​saking​phrancis,tiyang​phrancis​menika​ngrahos​bingung,hamargi​nalika​tumbas​hing​jepara,semarang,​lan​shurabaya​tansah​kepanggih​kaliyan​tiyang​hingkang​hasmanipun​jaka.nalika​kepanggih​kaliyan​jaka​widada​hing​shala,​kanggé​mbéntennaken​saking​jaka​jaka​hingkang​sanés,​tiyang​phrancis​kalawahu​paring​timbalan​jakawi.#bahasa Jawa|//panjenengngannipun​miyos​kanthi​hasma​hasli​jaka​widada.hananging​nalika​taksih​haktif​hing​jagad​bisnis​mébel​lan​kagungngan​tiyang​hingkang​tumbas​saking​phrancis,tiyang​phrancis​menika​ngrahos​bingung,hamargi​nalika​tumbas​hing​jepara,semarang,​lan​shurabaya​tansah​kepanggih​kaliyan​tiyang​hingkang​hasmanipun​jaka.nalika​kepanggih​kaliyan​jaka​widada​hing​shala,​kanggé​mbéntennaken​saking​jaka​jaka​hingkang​sanés,​tiyang​phrancis​kalawahu​paring​timbalan​jakawi.]])
    • Expected

local export = {}

local consonants = {
	['ꦏ']='k', ['ꦑ']='kh', ['ꦒ']='g', ['ꦓ']='gh', ['ꦔ']='ng',
	['ꦕ']='c', ['ꦖ']='ch', ['ꦗ']='j', ['ꦙ']='jh', ['ꦚ']='ny', 
	['ꦛ']='ṭ', ['ꦜ']='ṭh', ['ꦝ']='ḍ', ['ꦞ']='ḍh', ['ꦟ']='ṇ', 
	['ꦠ']='t', ['ꦡ']='th', ['ꦢ']='d', ['ꦣ']='dh', ['ꦤ']='n', 
	['ꦥ']='p', ['ꦦ']='ph', ['ꦧ']='b', ['ꦨ']='bh', ['ꦩ']='m',
	['ꦪ']='y', ['ꦫ']='r', ['ꦭ']='l', ['ꦮ']='w', 
	['ꦯ']='ś', ['ꦰ']='ṣ', ['ꦱ']='s', ['ꦲ']='h',
	['ꦬ']='r', --'Ra Agung' (obsolete letter)
	['ꦐ']='q', --'Ka Sasak' (obsolete letter), some say it's a replacement of 'q'
	['ꦘ']='jny', --'Nya murda' (obsolete letter?)
}

local diacritics = {
	['ꦴ']='ā', ['ꦶ']='i', ['ꦷ']='ī', ['ꦸ']='u', ['ꦹ']='ū', ['ꦼ']='ê', ['ꦺ']='e', ['ꦻ']='ai', ['ꦺꦴ']='o', ['ꦻꦴ']='au',
	['ꦿ']='ṛa', ['ꦿꦴ']='ṛā', ['ꦿꦶ']='ṛi', ['ꦿꦷ']='ṛī', ['ꦿꦸ']='ṛu', ['ꦿꦹ']='ṛū', ['ꦽ']='ṝê', ['ꦿꦺ']='ṛe', ['ꦽꦻ']='ṝai', ['ꦿꦺꦴ']='ṛo', ['ꦿꦻꦴ']='ṛau',
	['ꦿꦼ']='ṝê', --alternative, albeit wrong 'ṝê'
	['ꦾ']='ya', ['ꦾꦴ']='yā', ['ꦾꦶ']='yi', ['ꦾꦷ']='yī', ['ꦾꦸ']='yu', ['ꦾꦹ']='yū', ['ꦾꦼ']='yê', ['ꦾꦺ']='ye', ['ꦾꦻ']='yai', ['ꦾꦺꦴ']='yo', ['ꦾꦻꦴ']='yau',
	['ꦵ']='o', --Sundanese -o
}

local rekan = {
	['ꦏ']='kh', ['ꦢ']='dz', ['ꦥ']='f', ['ꦮ']='w', ['ꦗ']='z', ['ꦒ']='gh', 
}

local tt = {
	-- vowels
	['ꦄ']='a', ['ꦅ']='i', ['ꦆ']='ī', ['ꦇ']='ī', ['ꦈ']='u', ['ꦎ']='o', 
	['ꦉ']='ṛê', ['ꦊ']='ḷê', ['ꦋ']='ḹê', ['ꦌ']='e', ['ꦍ']='ai',
	-- chandrabindu    
	['ꦀ']='m̐', --until a better method is found
	['ꦁ']='ng', --final -ng
	['ꦃ']='ḥ', --final -h
	['ꦂ']='r', --final -r
	--numerals
	['꧐']='꧑', ['꧑']='1', ['꧒']='2', ['꧓']='3', ['꧔']='4', ['꧕']='5', ['꧖']='6', ['꧗']='7', ['꧘']='8', ['꧙']='9',
	--punctuation        
	['꧉']='. ', --period (followed by space, for legibility)
	['꧈']=', ', --comma (followed by space, for legibility)
	['꧊ ꧋']='', --beginning of paragraph
	['꧌']='"',
	['꧍']='"',
	['꧀']='',--virama; technically, every time this character occur, move back one character (the vowel is silenced) -- for syllable that ends with consonant.
	['​']=' ', --zero-width space
	--miscellaneous untransliterable punctuations
	['꧊']='', --? of uncertain usage
	['꧋']='', --beginning of paragraph
	['꧅']='', --pada luhur
	['꧄']='', --pada madya
	['꧃']='', --pada andhap
	['꧂']='', --rêrênggan têngên
	['꧁']='', --rêrênggan kiwa
	['꧟']='', --pada isen-isen
	['꧞']='', --pada tirta tumetes
	['꧆']='', --pada windu
}

function export.tr(text, lang, sc)
	text = mw.ustring.gsub(text, '(ꦚ꧀ꦗ)([ꦽꦿꦾ]?[ꦺꦻ]?[ꦴꦶꦷꦸꦹꦼ]?)', --sengau 'nyj' = 'nj'
		function(c, d)
			if d == "" then        
				return 'nj' .. 'a'
			else
				return 'nj' .. diacritics[d]
			end
		end)
	text = mw.ustring.gsub(text, '(ꦚ꧀ꦕ)([ꦽꦿꦾ꧀]?[ꦺꦻ]?[ꦴꦶꦷꦸꦹꦼ]?)', --sengau 'nyc' = 'nc'
		function(c, d)
			if d == "" then        
				return 'nc' .. 'a'
			else
				return 'nc' .. diacritics[d]
			end
		end)
	text = mw.ustring.gsub(text, '([ꦏꦢꦥꦮꦗꦒ])꦳([ꦽꦿꦾ꧀]?[ꦺꦻ]?[ꦴꦶꦷꦸꦹꦼ]?)', 
		function(c, d)
			if d == "" then        
				return rekan[c] .. 'a'
			elseif d == "꧀" then        
				return rekan[c]
			else
				return rekan[c] .. diacritics[d]
			end
		end)
	text = mw.ustring.gsub(
		text,
		'([ꦏꦐꦑꦒꦓꦔꦕꦖꦗꦘꦙꦚꦛꦜꦝꦞꦟꦠꦡꦢꦣꦤꦥꦦꦧꦨꦩꦪꦫꦬꦭꦮꦯꦰꦱꦲ])([ꦽꦿꦾ꧀]?[ꦺꦻ]?[ꦴꦶꦷꦸꦹꦼ]?)', --fix (determine whether vowel or not)
		function(c, d)
			if d == "" then        
				return consonants[c] .. 'a'
			elseif d == "꧀" then        
				return consonants[c]
			else
				return consonants[c] .. diacritics[d]
			end
		end)

	text = mw.ustring.gsub(text, '.', tt)
	
	return text
end
 
return export