MoathOthman / MOLH

Localization helper for iOS apps mainly focusing on the LTR/RTL issue
MIT License
117 stars 36 forks source link

set Default Language to Arabic not working right on first run #60

Open oenama opened 4 years ago

oenama commented 4 years ago

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

MoathOthman commented 4 years ago

@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

oenama commented 4 years ago

@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

MoathOthman commented 4 years ago

Can you try the demo project and compare the results

Sent from my iPhone

On Jun 1, 2020, at 12:56 PM, oenama notifications@github.com 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.

oenama commented 4 years ago

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.

MoathOthman commented 4 years ago

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

oenama commented 4 years ago

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

MoathOthman commented 4 years ago

I see, thats weird

omar1taha commented 3 years ago

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?

AbuMandour commented 3 years ago

am have the same problem also in iPhone v 14.0.1

MoathOthman commented 3 years ago

@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

AbuMandour commented 3 years ago

@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

MoathOthman commented 3 years ago

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

AbuMandour commented 3 years ago

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

Hzza3 commented 3 years ago

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

MoathOthman commented 3 years ago

@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.

ASamirbadran commented 3 years ago

same issue here

MoathOthman commented 3 years ago

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

ASamirBadranIbtikar commented 3 years ago

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

MoathOthman commented 3 years ago

@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