Add support for transliteration from Latin to Cyrillic script #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds support for creating Cyrillic version of a website which uses Latin as a main script. Even though this may not be original purpose of SrbTransLatin, I thought that it might be nice addition to already existing feature set. If you disagree, this might be a good starting point for new plugin - SrbTransCyrillic :)
In order to accomplish this, I've had to add new option on the settings page - "origin script". By default, it is set to "Cyrillic" and if you don't change that value, plugin will behave exactly the same as before.
However, if you choose to change this value to "Latin", the plugin will transliterate the whole page to Cyrillic if users select Cyrillic script. Since we are dealing with the raw HTML, I've used already included
simplehtmldom/simplehtmldom
library to extract and transliterate only the textual part of the page, leaving HTML tags, CSS and JS parts in their original form. This part still needs to be tested with various pages before we can be sure that it doesn't cause unexpected issues.Finally, if you decide to merge this PR, we need to check transliteration of RSS and other feeds and, possibly, introduce additional shortcodes to achieve feature-parity with original extension.