MoathOthman / MOLH

Localization helper for iOS apps mainly focusing on the LTR/RTL issue

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

converting language from ar to eng or reverse

lamatat opened this issue · comments

am getting this error when changing the language to eng from ar

screen shot 2018-05-29 at 1 44 29 pm

what is this error and how to solve it please?

thanks in advance..

any news about this? @MoathOthman

yes i did tried it .. i will try doing that and let you know ..

i just tried but didn't know how to do it x_x
but i think this happened when i used MOLHLanguage.isArabic()

got same error ...

trie to comment them all .. and worked without errors .. so the problem is really from MOLHLanguage.isArabic() and MOLHLanguage.isRTL()

but i need to know if its arabic or not so i need to use one of them :(

if you please can help me solve this

thanks in advance!

just two .. english and arabic

can you replace the function with this
/// get current Apple language
public class func currentAppleLanguage() -> String {
let userdef = UserDefaults.standard
let langArray = userdef.object(forKey: APPLE_LANGUAGE_KEY) as! NSArray
let current = langArray.firstObject as! String
let currentWithoutLocale = current.substring(to: current.index(current.startIndex, offsetBy: 2))
return currentWithoutLocale
}

screen shot 2018-05-30 at 3 25 48 pm

got the same error in next function ...

you mean just to do pod update?
or do you have a version number to add in podfile?
sorry i didn't really get what do you mean x_x

i got this [!] Unable to find a specification for 'MOLH'.

@lamatat

i got this [!] Unable to find a specification for 'MOLH'.

its fixed now , thanx for pointing it out. please try again.

am getting the same error even after updating the pod

screen shot 2018-05-31 at 11 32 19 am

@lamatat can you debug it , print the result of userdef.object(forkey: ....)

got this:
Optional(<__NSSingleObjectArrayI 0x125d6bd70>(
ar
)
)
before crashing...

NSSingleObjectArray!, interesting , I think you have only one language for the device which is arabic, right? , if you go to settings app -> general -> languages , you should see one language, right?

no there's 2 .. english and arabic

sorry i was running the app with arabic language x_x
now changed it to system language and got this:
Optional(<__NSCFArray 0x13de224a0>(
ar,
en
)
)

@lamatat do you still get the crash then?

yes i do
same crash as the screenshot above

mmmm, thats really weird. is there any environment factors you have, did you try it on device while not in debug mode?
I updated the code to swift 4 , can you pod install again and try?

same :(
please help me solve this T_T

found out something ...
this is only happens when used in: class TextField: UITextField for example...
any idea?

@lamatat since textfield functionality is not that perfect,
comment out the line where its swizzled ..
swizzle(class:UITextField.self, sel: #selector(UITextField.layoutSubviews), override: #selector(UITextField.cstmlayoutSubviews))

just found something ...
this has nothing to do with your library ...
because i have tried:
let pre = Locale.preferredLanguages.first
if pre == "ar"{
......
}
and got the same error! which is really wired!

sorry for all the trouble but it has nothing to do with your awesome library :)
i have another question i will open new issue if you please can check it out .. thanks

sure.. thanks you :)!