MOLH icon indicating copy to clipboard operation
MOLH copied to clipboard

set Default Language to Arabic not working right on first run

Open oenama opened this issue 4 years ago • 19 comments

on didFinishLaunchingWithOptions

       MOLH.reset()
       MOLHLanguage.setDefaultLanguage("ar")
       MOLH.shared.activate(true)

UITextField, UITextView, UINavigationController's swipe gesture for back are not flipped right on the first run. and I did uncheck 'Respect language direction' in one or two places in storyboard, but it was flipped to left as if I didn't uncheck this option.

I tried to change semanticContentAttribute, but it didn't work either :

UITextField.appearance().semanticContentAttribute = .forceRightToLeft
UINavigationBar.appearance().semanticContentAttribute = .forceRightToLeft
UITextView.appearance().semanticContentAttribute = .forceRightToLeft

is that normal on first run? any thoughts on it?

@MoathOthman

oenama avatar May 31 '20 13:05 oenama

@oenama you can call reset() function after MOLH.shared.activate(true) , that should fix it for you,, the reason for the previous behaviour is that the root is already set when you call

  MOLH.reset()
       MOLHLanguage.setDefaultLanguage("ar")
       MOLH.shared.activate(true)

let me know how it goes with you

MoathOthman avatar May 31 '20 14:05 MoathOthman

@oenama you can call reset() function after MOLH.shared.activate(true) , that should fix it for you,, the reason for the previous behaviour is that the root is already set when you call

  MOLH.reset()
       MOLHLanguage.setDefaultLanguage("ar")
       MOLH.shared.activate(true)

let me know how it goes with you

same issue at first run. @MoathOthman

oenama avatar Jun 01 '20 09:06 oenama

Can you try the demo project and compare the results

Sent from my iPhone

On Jun 1, 2020, at 12:56 PM, oenama [email protected] wrote:



@oenamahttps://github.com/oenama you can call reset() function after MOLH.shared.activate(true) , that should fix it for you,, the reason for the previous behaviour is that the root is already set when you call

MOLH.reset() MOLHLanguage.setDefaultLanguage("ar") MOLH.shared.activate(true)

let me know how it goes with you

same issue at first run. @MoathOthmanhttps://github.com/MoathOthman

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/MoathOthman/MOLH/issues/60#issuecomment-636751047, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAI43B7DHHHOSWPM7MCNAPDRUN3LBANCNFSM4NPE6KWA.

MoathOthman avatar Jun 01 '20 10:06 MoathOthman

Can you try the demo project and compare the results

I've tested it on the demo project, added what you suggested, UITextField flipped correctly, but still, UINavigationController's swipe gesture not flipped to right on first run.

oenama avatar Jun 01 '20 17:06 oenama

https://youtu.be/RXyFiy8OEq4

I tried it in the demo , it seems fine, clone the latest code.

the code looks like this

 MOLHFont.shared.arabic = UIFont(name: "Courier", size: 13)!
        MOLHLanguage.setDefaultLanguage("ar")
        MOLH.shared.activate(true)
        MOLH.shared.specialKeyWords = ["Cancel","Done"]
        reset()

@oenama

MoathOthman avatar Jun 01 '20 18:06 MoathOthman

for UINavigationController's back button, I meant the swipe gesture itself

on first run --> https://www.dropbox.com/s/md5l0n1phj3sfhz/01.mov?dl=0 the normal/ defualt behaviour for RTL --> https://www.dropbox.com/s/7m3g8u582zr5r18/02.mov?dl=0

@MoathOthman

oenama avatar Jun 01 '20 19:06 oenama

I see, thats weird

MoathOthman avatar Jun 01 '20 19:06 MoathOthman

I'm facing the same issue, after the first run all the alignment is good but the first install and run is not activated. Any updates on this issue?

omar1taha avatar Nov 02 '20 12:11 omar1taha

am have the same problem also in iPhone v 14.0.1

AbuMandour avatar Nov 11 '20 16:11 AbuMandour

@oenama I am terribly sorry for the late reply, got really busy and forgot about this issue. for the navigation issue its now fixed 👍 in version 1.4.3 @AbuMandour u facing the same issue or the default language not working? @omar1taha sorry for the late reply, the keypoint here is to call reset after setting the default language, check the code above in this thread

MoathOthman avatar Nov 12 '20 08:11 MoathOthman

@MoathOthman when I set default language to Arabic first time some alignment didn't apply in the right way but it fixed once close and reopen

AbuMandour avatar Nov 17 '20 20:11 AbuMandour

@AbuMandour hey, can you provide example e.g. screenshots of the ui elements not working.

MoathOthman avatar Nov 18 '20 23:11 MoathOthman

in AppDelegate I do this

        MOLHLanguage.setDefaultLanguage("ar")
        MOLH.shared.activate(true)

and in any controller label direction goes to ltr just in the first run and with labels which load from API 134728416_395307324882374_4707758817411621812_n

AbuMandour avatar Dec 31 '20 13:12 AbuMandour

@MoathOthman I have the same issue, application in the first launch alignment is wrong and i have to terminate the app and reopen again

Hzza3 avatar Jan 01 '21 14:01 Hzza3

@AbuMandour @Hzza3 hey guys, can you check this issue https://github.com/MoathOthman/MOLH/issues/64, you need to se the tags for the labels.

MoathOthman avatar Jan 01 '21 20:01 MoathOthman

same issue here

ASamirbadran avatar Jan 20 '21 15:01 ASamirbadran

@ASamirbadran have you tried ~MOLHLanguage.setDefaultLanguage("ar") MOLH.shared.activate(true)

MoathOthman avatar Jan 25 '21 19:01 MoathOthman

@MoathOthman yes and problem still exist Note : iam using swiftgen in my app

ASamirBadranIbtikar avatar Jan 25 '21 20:01 ASamirBadranIbtikar

@ASamirBadranIbtikar what did you try? what was the result exactly? and what do you expect?
cam you provide sample screenshot or any info to help us here, if you can reproduce it in a sample code it will be great. i have not tried swiftgen but i don;t think it will hurt unless it does swizzling or something on the run time. have you checked this #64

MoathOthman avatar Jan 25 '21 20:01 MoathOthman