iOS Question >[SOLVED] XUI Dateutils locale

astronald

Member
Licensed User
Longtime User
Hello how i can locale for IOS
i try this code
Date Utils0:
Dim days As List = DateUtils.GetDaysNames
Works perfect in B4A
but in b4i only get english days


Thanks
 

astronald

Member
Licensed User
Longtime User
Thanks oparra, my device is config in spanish.

Thanks Erel, i try this solution but, i can't see error.

file.png

This is IOS Capture
IOS.png

This is Android Capture
Android.png


this is my Code for capital name days

Name Day:
Dim days As List = DateUtils.GetDaysNames
For i = Main.PrimerDia To Main.PrimerDia + 6
Dim d As String = days.Get((i-1) Mod 7)
d = d.SubString2(0,1).ToUpperCase & d.SubString2(1,3)
NomDias(i - Main.PrimerDia) = d
Next

I am using wonderful B4XPages
 
Last edited:
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
test:
B4X:
SetDateTimeLocale ("es_ES")

Sub SetDateTimeLocale (locale As String)
   Dim loc As NativeObject
   loc = loc.Initialize("NSLocale").RunMethod("localeWithLocaleIdentifier:", Array(locale))
   Dim no As NativeObject = DateTime
   no.GetField("dateFormat").SetField("locale", loc)
   no.GetField("timeFormat").SetField("locale", loc)
End Sub


iOS Locale Identifiers
 
Last edited:
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
How i can get default IOS language?

B4X:
Sub GetPreferredLanguage As String
    Dim no As NativeObject
    Return no.Initialize("NSLocale") _
        .RunMethod("preferredLanguages", Null).RunMethod("objectAtIndex:", Array(0)).AsString
End Sub

SEE:
 
Upvote 0
Top