Hari KT Posted February 6 Share Posted February 6 When adding a language from Setup > Languages , where can we specify the direction is RTL ? So that the input field values direction change. Basically I need to work on the Arabic language. Link to comment Share on other sites More sharing options...
bernhard Posted February 6 Share Posted February 6 I don't know for sure but I don't think that this is possible. All posts that I found do not mention any solutions either: https://processwire.com/talk/topic/17834-how-to-rtl-admintheme-core-files/ https://processwire.com/talk/topic/7262-ckeditor-rtl/ https://processwire.com/talk/topic/13540-ck-editor-rlt-for-arabic/ (@flydev seems to have tested it) But UIkit supports RTL, so it might be possible? 1 Link to comment Share on other sites More sharing options...
Hari KT Posted February 6 Author Share Posted February 6 This is possible if we can add dir="rtl" inside the input element. Inorder for this to happen, when creating new language we need to define the direction as rtl. I have manually edited the input field and added dir=rtl . Link to comment Share on other sites More sharing options...
flydev Posted February 8 Share Posted February 8 Hi, you could set a hook to set dir attribute on html tag or only on input(s) on language based and using bidir plugin on ck-editor to get parts of or whole backend as rtl as explained in thread linked by Bernhard, still seem the way to go. 1 Link to comment Share on other sites More sharing options...
Hari KT Posted February 8 Author Share Posted February 8 One solution I got from @ryan https://github.com/processwire/processwire-issues/issues/2037#issuecomment-2643216328 the most direct to me seems just to use a hook in `site/templates/admin.php` and apply the dir attribute with JS. 1. $wire->addHookAfter('ProcessPageEdit::execute', function(HookEvent $e) { $rtl = [ 'arabic', 'japanese' ]; $js = ''; foreach($e->wire()->languages as $l) { if(!in_array($l->name, $rtl)) continue; $js .= "$('.LanguageSupport[data-language=$l]').find('input[type=text],textarea').attr('dir', 'rtl');"; } if($js) $e->return .= "<script>$js</script>"; }); If you wanted it configurable with a checkbox on each language page (in Setup > Languages). Then you'd add a new checkbox field named "rtl" to your "language" template, and then use this code instead: 2. $wire->addHookAfter('ProcessPageEdit::execute', function(HookEvent $e) { $js = ''; foreach($e->wire()->languages as $l) { if(!$l->rtl) continue; $js .= "$('.LanguageSupport[data-language=$l]').find('input[type=text],textarea').attr('dir', 'rtl');"; } if($js) $e->return .= "<script>$js</script>"; }); I have used the 2nd option. Also Quote adding to `site/ready.php` worked. But not in `site/templates/admin.php` Expand The only issue now is the ckeditor / tinymce is not rtl. I want to find a way to fix that also. Link to comment Share on other sites More sharing options...
flydev Posted February 8 Share Posted February 8 Good. On 2/8/2025 at 10:45 AM, Hari KT said: The only issue now is the ckeditor / tinymce is not rtl. I want to find a way to fix that also. Expand Read my answer there for ckeditor (no idea for tinymce): 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now