mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-12-07 01:08:06 +00:00
Add experimental support for RTL languages
This commit permits language plugins to carry the field “text-direction” with the value “rtl” to trigger right-to-left layout of the entire page. We also adjust the sidebar layout to work in RTL mode. There are still a number of problems to be addressed: * Brackets and other punctuation incorrectly placed within en-GB UI text * System tiddler titles are rendered semi-back-to-front (eg `languages/ca-ES/:$`) Starting to address #1845 and the discussion in #2523.
This commit is contained in:
@@ -63,7 +63,18 @@ exports.startup = function() {
|
||||
controllerTitle: "$:/language",
|
||||
defaultPlugins: [
|
||||
"$:/languages/en-US"
|
||||
]
|
||||
],
|
||||
onSwitch: function(plugins) {
|
||||
if($tw.browser) {
|
||||
console.log("switching language",plugins)
|
||||
var pluginTiddler = $tw.wiki.getTiddler(plugins[0]);
|
||||
if(pluginTiddler) {
|
||||
document.documentElement.setAttribute("dir",pluginTiddler.getFieldString("text-direction") || "auto");
|
||||
} else {
|
||||
document.documentElement.removeAttribute("dir");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// Kick off the theme manager
|
||||
$tw.themeManager = new $tw.PluginSwitcher({
|
||||
|
||||
Reference in New Issue
Block a user