Module:ja-kana-def

Hello, you have come here looking for the meaning of the word Module:ja-kana-def. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:ja-kana-def, but we will also tell you about its etymology, its characteristics and you will know how to say Module:ja-kana-def in singular and plural. Everything you need to know about the word Module:ja-kana-def you have here. The definition of the word Module:ja-kana-def will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:ja-kana-def, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}
local replace = mw.ustring.gsub
local m_ja = require('Module:ja')
local translit = require("Module:Hrkt-translit").tr

local kana_data = {
	-- ={'順','行','段'},
	={ '1','あ','あ'}, ={ '2','あ','い'}, ={ '3','あ','う'}, ={ '4','あ','え'}, ={ '5','あ','お'},
	={ '6','か','あ'}, ={ '7','か','い'}, ={ '8','か','う'}, ={ '9','か','え'}, ={'10','か','お'},
	={'11','さ','あ'}, ={'12','さ','い'}, ={'13','さ','う'}, ={'14','さ','え'}, ={'15','さ','お'},
	={'16','た','あ'}, ={'17','た','い'}, ={'18','た','う'}, ={'19','た','え'}, ={'20','た','お'},
	={'21','な','あ'}, ={'22','な','い'}, ={'23','な','う'}, ={'24','な','え'}, ={'25','な','お'},
	={'26','は','あ'}, ={'27','は','い'}, ={'28','は','う'}, ={'29','は','え'}, ={'30','は','お'},
	={'31','ま','あ'}, ={'32','ま','い'}, ={'33','ま','う'}, ={'34','ま','え'}, ={'35','ま','お'},
	={'36','や','あ'},                          ={'37','や','う'},                          ={'38','や','お'},
	={'39','ら','あ'}, ={'40','ら','い'}, ={'41','ら','う'}, ={'42','ら','え'}, ={'43','ら','お'},
	={'44','わ','あ'}, ={'45','わ','い'},                          ={'46','わ','え'}, ={'47','わ','お'},
	={'48', nil, nil},
}

local function link(term, tr, gloss)
	if not tr then tr = translit(term, "ja") end
	return require('Module:links').full_link({lang = require('Module:languages').getByCode('ja'), term = term, tr = tr, gloss = gloss}, 'term')
end

local function to_ordinal(text)
	return mw.getCurrentFrame():expandTemplate{ title = 'ordinal to word', args = { text } }
end

function export.show(frame)
	local args = frame:getParent().args
	local syllable = mw.title.getCurrentTitle().text
	local k2h_syllable = m_ja.kata_to_hira(syllable)
	local manual_translit = args or nil

	local text = 'The $script syllable $syllable. Its equivalent in $other_script is $other_syllable.'
	local text_two = 'It is the $order syllable in the ] order'
	local text_three = '; its position is $position.'

	if m_ja.script(syllable) == 'Hira' then
		text = replace(text, '$script', ']')
		text = replace(text, '$other_script', ']')
		text = replace(text, '$syllable', link(syllable, manual_translit))
		text = replace(text, '$other_syllable', link(m_ja.hira_to_kata(syllable), manual_translit))
	elseif m_ja.script(syllable) == 'Kana' then
		text = replace(text, '$script', ']')
		text = replace(text, '$other_script', ']')
		text = replace(text, '$syllable', link(syllable, manual_translit))
		text = replace(text, '$other_syllable', link(k2h_syllable, manual_translit))
	else
		error(syllable .. ' is not a kana character or sequence.')
	end

	if syllable == 'ん' then
		text_two = replace(text_two, '$order', to_ordinal(kana_data))
		return text .. ' ' .. text_two .. '.'
	elseif syllable == 'ン' then
		text_two = replace(text_two, '$order',  to_ordinal(kana_data))
		return text .. ' ' .. text_two .. '.'
	elseif kana_data or kana_data then
		if m_ja.script(syllable) == 'Kana' then
			kana_data = kana_data -- kana_data = kana_data
			kana_data = m_ja.hira_to_kata(kana_data) -- kana_data = k2h(kana_data)
			kana_data = m_ja.hira_to_kata(kana_data) -- kana_data = k2h(kana_data)
		end
		text_two = replace(text_two, '$order', to_ordinal(kana_data))
		text_three = replace(text_three, '$position',
			link(
					kana_data .. ']' .. kana_data .. ']',
					translit(kana_data, "ja") .. '-gyō ' .. translit(kana_data, "ja") .. '-dan',
					"row ''" .. translit(kana_data, "ja") .. "'', section ''" .. translit(kana_data, "ja") .. "''"
			)
		)
		return text .. ' ' .. text_two .. text_three
	else
		return text
	end
end

return export