Closed ibhavin closed 7 years ago
As far as I understand ios_language_manager swaps out the bundle files but doesn't set the properties of the language LTR = true
. I found this property of UIView
semanticcontentattribute. Either you make a pull request the ios_language_manager to make sure the lib can handle LRT languages or as you change language in your app you set the semanticcontentattribute
property. I think this works UIView.appearance().semanticContentAttribute = .forceRightToLeft
:)
@bogren Placeholder change only after I close the app and restart it but other UI displays RTL without restart the app. I have tried UIView.appearance().semanticContentAttribute = .forceRightToLeft
when I change to arabic from english but issue is not solved.
Ah okay. I'm looking at some of the previous issues we have reported, I'll try to read up on what is not working with LTR for SkyFloatingLabelTextField. If you find a solution to fix please submit a PR :)
I think this might relate to the fact that we explicitly set alignment rather than using natural alignment
I'm having the same issue too. With or without setting the alignment.
Thanks for the PR @Mehrdadmaskull, can you retest against master?
The PR from @Mehrdadmaskull is merged and was released as part of 3.1.0. Please try this version
Hey,
Thanks for this helpful issue. I have a problem: in Main.strings (Arabic) I wrote:
"YGo-es-Lf5.placeholder" = "كلمة المرور";
But as you can see in the image below the field didn't change! how can I change it?
Thanks.
@bogren care to comment. I don't exactly remember the details of iOS localization anymore. Make sure the id matches the id of the textfield is all I can think of
Hi all, I am having the same issue , when I change Language from arabic to english or vice versa SkyFloatingLabelTextField is not updating according to LTR or RTL.After restarting the app LTR and RTL is working for SkyFloatingLabelTextField,but when I am changing language, runtime it is not updating.
My xcode version : 10.1 SkyFloatingLabelTextField version : 3.6.0
Hi all, I am having the same issue , when I change Language from arabic to english or vice versa SkyFloatingLabelTextField is not updating according to LTR or RTL.After restarting the app LTR and RTL is working for SkyFloatingLabelTextField,but when I am changing language, runtime it is not updating.
My xcode version : 10.1 SkyFloatingLabelTextField version : 3.6.0
Any solution for this?
This issue Still Exits On the Latest..As a workaround you will have to handle it by own .. i was able to handle this like this We only needed support for arabic language.
import UIKit
import SkyFloatingLabelTextField
class SkyFloatingUITextFeildWithRtl: SkyFloatingLabelTextField {
override func layoutSubviews() {
super.layoutSubviews()
checkForArabicLanguage()
}
private func checkForArabicLanguage(){
if (ApplicationServiceProvider.shared.isCurrentAppLanguageArabic()){
isLTRLanguage = false
}else {
isLTRLanguage = true
}
}
}
Then applied this Custom class as View on Storyboard and Outlet..Done
func textfieldAlingment(_ lang: String){ if lang == "en" { txtNewPassword.textAlignment = .natural txtReenterPassword.textAlignment = .natural } else { txtNewPassword.textAlignment = .right txtReenterPassword.textAlignment = .right } }
call it in View Will Appear override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) if UserDefaults.standard.object(forKey: "appLanguage") as? String == "en" { UIView.appearance().semanticContentAttribute = .forceLeftToRight textfieldAlingment("en") }else if UserDefaults.standard.object(forKey: "appLanguage") as? String == "ar" { UIView.appearance().semanticContentAttribute = .forceRightToLeft textfieldAlingment("ar") } }
I have implemented localization Internally(To change language inside app) in app by using this github repo : ios_language_manager
While changing language from app (Not iPhone language) from English to Arabic it is not changing UITextFiled's placeholder text and value to RTL. But if I change the iPhone language to Arabic then it works perfectly.
Both of the below textfield's text alignment is natural from storyboard. Without text input only placeholder text (Placeholder should come from right side)
With text input and floating placeholder (Text should come from right side)
If I change language from iPhone settings then it works perfectly.
Without text input only placeholder text (Perfect)
With text input and floating placeholder (Perfect)