SrbTransLatin

By : pedjas

Contents of the site should be written using Cyrillic script. Then, this plugin will allow users to choose to read contents in Cyrillic or Latin script.

If some contents is entered in Latin script, it would stay in Latin even if user chooses to use Cyrillic. Transliteration occurs only from Cyrillic to Latin script.

Site owner may set default for script to show: - Cyrillic, - Latin and - Cyrillic if visitor accepts it (has set some Cyrillic language as acceptable in his browser)

Script also may be selected manually, by adding ?lang=cir or ?lang=lat to document url. If parameter is not specified default script is used.

Site owner may use widget to allow visitors to choose among Cyrillic and Latin script. He may choose if script options are shown as html links or items of combo box. By default, html link are dipslayed. He also may set if widget would show title or not.

When user selects script, his choice stays permanent while he is on site. All internal links within site are altered to contain information about selected script. This means, when link is copied and pasted to some other site, it would contain information which script to use for displaying contents. There is an option to remember choosen script as cookie in visitor's brower so he has no need to set it again on future visits.

When transliteration occurs, everything in the HTML document is transliterated from Cyrillic to Latin script except if contents is placed among [lang id="skip"] and [/lang] tags. This leaves user to mark part of the text he does not want to be transliterated at all, meaning, some parts of Cyrillic text may stay Cyrillic even if user chooses to view site in Latin script.

Initially, when new article is posted using Cyrillic script in title, permalink is created with conversion to Latin script. Site owner may turn it of.

Transliteration works for all feeds too (atom, rdf, rss, rss2).

Using script selector on custom places

If you need to put script selector in site template outside widgets areas then you can use function stl_show_selector() provided with plugin. Function accepts four parameters (all optional):

stl_show_selector (selector_type, oneline_separator, cyrillic_caption, latin_caption, inactive_script_only, show_only_on_wpml_languages)

selector_type chooses which type of selector to display:

  • links - list of choices in form of widget items

  • list - list of choices in form of dropdown selection

  • oneline - list of choices as one line separated by oneline_separator

Default value is 'oneline'

oneline_separator is a string that should be inservted between script selection items. Default value is '/'.

cirillic_caption is a string that should be used as caption for item of cyrillic sleection. Default is 'ћирилица'

latin_caption is a string that should be used as caption for item of latin sleection. Default is 'латиница'

inactive_script_only if checked dosplays only option to select inactive script, currently active script wil not be an option

show_only_on_wpml_languages contains list of WPML languages comma separated for which script selection swhould be visible

To use this function just call it from place where you need code to be inserted, like:

<?php stl_show_selector('oneline', '/', 'ћирилица', 'латиница') ?>

Changing image depending on selected script

If you want to add image on page which contains Czrillic text and you want it to be replaced with image that contains Latin script then add =cir= as suffix in image name. On transliteration, Image name wil be changed to have =lat= as suffix.

Example: filename=cir=.jpg wil be replaced with filename=lat=.jpg

You have to provide Latin version image at same path as Cyrillic image is placed, of course.

Fix url colision with other plugins

There are some plugings that also use default identificator 'lang', which SrbTransLatin uses to pass selected script information through url. To fix this there is an option to set this identificator. If you have problems with other plugins just change this to 'script' or 'lng', or something else as you like.

Pay attention that if you change this option, all previous urls containing script selection will become invalid. It is best to set this before site is heavily indexed or externally linked.

Fix priority colision with other plugins

SrbTransLatin as a rule should be the last plugin executed, so it can process page content after all content is generated by other plugins. At least it should be the last of plugins that generate content.

By default, SrbTranslatin uses priority 99 to make good chance to be at the end of executing plugin list. If for some reason it does not work well, user can change priority.

There is config_example.php in SrbTransLatin directory. User should copy that to config.php and edit new file. There is a line saying:

$stl_config['priority'] = 9999;

User may change number 9999 to any other. Greater number is lower priority, meaning exexuting after plugins with lower number.

WPML compatibility

It is quote often that users of SrbTranslatin als use WPML and they meet with conflict as both plugins use the same language identificator 'lang'. SrbTransLatin has an option for user to set different language identificator to resolve conflict.

Moreoever, on installation, SrbTranslatin will check if WPML is installed and it will change it's language identificator. Also, when conflict is possible, warning will be presented to user while in SrbTransLatin settings.

When setting widget, or using user have an option to set language identificators used by WPML which for widget will be invisible.

Acknowledgements

This plugin is developed inspired by two plugins WP Translit by Aleksandar Urošević and srlatin by Kimmo Suominen. I actually merged functionality of these two and expanded it with a lot of new functionality I needed for my site, and later with new functionality asked by plugin users.

WP Translit

When visitor enter some site written in Serbian Cyrillic script, WP Translit can automatically or on demand transliterate that site to Latin script. This is performed by checking Accept Language HTTP headers. If visitor don't have Serbian, Macedonian, Bulgarian or Russian language set as preferred .........

Similar: 40%

Cyr-To-Lat

Converts Cyrillic characters in post, page and term slugs to Latin characters. Useful for creating human-readable URLs....

Similar: 34%

cyr-to-arabic

This plugin can convert text from Kazakh Cyrillic to Arabic script in posts....

Similar: 31%

WP Nice Slug

Plugin sanitizes title for post slug, replacing non-Latin characters to ASCII. Requires PECL::Package::translit At the moment the supported transliteration filters include: * Cyrillic-to-Latin transliteration; * Greek-to-Latin transliteration; * Han-to-Latin transliteration; * Hebrew-to-Latin tran.........

Similar: 31%

ACF: Rus-To-Lat

Add-On plugin for Advanced Custom Fields (ACF) that converts Cyrillic characters in field name to Latin characters....

Similar: 28%

wp-cyr-cho | Конвертира кирилски символи в латиниски

Този плъгин (приставка, разширение) е направен, за да транслитерира кирилицата която се поява в URL-тата на WordPress блоговете. Механизмът за конвертиране е взаимстван от оригиналното решение на “Лошия”, като този плъгин прави мащаба на транслитерацията в блога по-голям, като се работят.........

Similar: 25%

Cyr to Lat enhanced

Converts Cyrillic and Georgian characters in post, page and term slugs to Latin characters. Useful for creating human-readable URLs. This plugin is a fork of cyr2lat plugin....

Similar: 22%

Cyr-And-Lat

Converts Cyrillic characters in post, page and term slugs to Latin characters. Useful for creating human-readable URLs. After the activation changes every slug to Latin characters, but old slugs will work too....

Similar: 22%

MK to Lat

It converts the Macedonian cyrillic characters of the title posts into latin to build better, readable and Search Engine Friendly urls. For example: Lets say you want your wordpress to be in Macedonian. So you intall wordpress, install the Macedonian language files, translate the template menus an.........

Similar: 19%

National Characters

The plugin allows you to enter national characters (special characters) in username during registration. Based on the WP core function. WordPress does not allow to use national characters in usernames by default. This plugin fixes this issue....

Similar: 16%