 local pu800 local types "book_en" 'book' "book_fa" 'u8daa9u8d8aau8d8a7u8d8a8' "web_en" 'webu800' "web_fa" 'u8d988u8d8a8' "cite_en" 'citation' "cite_fa" 'u8db8cu8d8a7u8d8afu8daa9u8d8b1u8d8af u8d987u8d8b3u8d8aau8d987 u8d9beu8d988u8d8afu8d985u8d8a7u8d986' "journal_en" 'journal' "journal_fa" 'u8da98u8d988u8d8b1u8d986u8d8a7u8d984' "encyclopedia_en" 'encyclopedia' "encyclopedia_fa" 'u8d8afu8d8a7u8d986u8d8b4u8d986u8d8a7u8d985u8d987' "podcast_en" 'podcast' "podcast_fa" 'u8d9beu8d8a7u8d8afu8daa9u8d8b3u8d8aa' "news_en" 'news "news_fa" 'u8d8aeu8d8a8u8d8b1' "magazine_en" 'magazine' "magazine_fa" 'u8d985u8d8acu8d984u8d987' "interview_en" 'interview' "interview_fa" 'u8d985u8d8b5u8d8a7u8d8adu8d8a8u8d987' "arxiv_en" 'arxiv' "arxiv_fa" 'u8d8a2u8d8b1u8daa9u8d8a7u8db8cu8d988' "av_en" 'avu800 media' "av_fa" 'u8d988u8db8cu8d8afu8d8a6u8d988' "conference_en" 'conference' "conference_fa" 'u8daa9u8d986u8d981u8d8b1u8d8a7u8d986u8d8b3' "map_en" 'mapu800' "map_fa" 'u8d986u8d982u8d8b4u8d987' ; function getlangcode lang getu800 theu800 code ofu800 theu800 language ifu800 full language name isu800 given ifu800 3u800 lang lenu800 then local languages mwu800u82eloaddata 'u8d9beu8d988u8d8afu8d985u8d8a7u8d986 citation lang data isou800 639u800 1u800' local langcode languages lang ifu800 langcode nilu800 then return langcode 1u800 endu800 else return lang endu800 endu800 function pu800u82etestlang frame return getlangcode frameu82eargs 'lang' endu800 returns theu800 citation template name based onu800 theu800 u8d8b2u8d8a8u8d8a7u8d986 parameter function pu800u82eis_rtl frame cite_type frameu82eargs 'type' ; type ofu800 theu800 citation template book webu800 etcu800. lang mwu800u82eustringu82elower frameu82eargs 'lang' language code lang_code getlangcode lang local rtl_langs 'fau800' true 'fau800 iru800' true 'aru800' true 'uru800' true 'heu800' true ifu800 lang_code "" oru800 lang_code nilu800 oru800 rtl_langs lang_code then ifu800 cite_type "cite" then return types "cite_fa" else return "u8db8cu8d8a7u8d8afu8daa9u8d8b1u8d8af "..types cite_type.."_fau800" .." u8d987u8d8b3u8d8aau8d987" endu800 else ifu800 cite_type "cite" then return types "cite_en" else return "cite "..types cite_type.."_enu800" endu800 endu800 endu800 returns theu800 citation template name based onu800 theu800 characters inu800 title function pu800u82eis_rtl2 frame cite_type frameu82eargs 'type' ; type ofu800 theu800 citation template book webu800 etcu800. title frameu82eargs 'title' ifu800 title match " u8d8a7u8d8a8u8d9beu8d8aau8d8b3u8d8acu8da86u8d8adu8d8aeu8d8afu8d8b0u8d8b1u8d8b2u8da98u8d8b3u8d8b4u8d8b5u8d8b6u8d8b7u8d8b8u8d8b9u8d8bau8d981u8d982u8daa9u8daafu8d984u8d985u8d986u8d988u8d987u8db8cu8dbb1u8dbb2u8dbb3u8dbb4u8dbb5u8dbb6u8dbb7u8dbb8u8dbb9u8dbb0 " then u8d8a7u8daafu8d8b1 u8daa9u8d8a7u8d8b1u8d8a7u8daa9u8d8aau8d8b1u8d987u8d8a7u8db8c u8d981u8d8a7u8d8b1u8d8b3u8db8c u8d8afu8d8a7u8d8b4u8d8aa ifu800 cite_type "cite" then return types "cite_fa" else return "u8db8cu8d8a7u8d8afu8daa9u8d8b1u8d8af "..types cite_type.."_fau800" .." u8d987u8d8b3u8d8aau8d987" endu800 else ifu800 cite_type "cite" then return types "cite_en" else return "cite "..types cite_type.."_enu800" endu800 endu800 endu800 return pu800 