YLMoment icon indicating copy to clipboard operation
YLMoment copied to clipboard

Localization problem time string change locale without config.

Open giver opened this issue 11 years ago • 8 comments

Before update to 0.3.0, I think my locale default with 'en' but after update to 0.3.0 my locale was automatic change to 'de' (I notice by the string it was produced). I don't know why. Because I never touch the localization setting in my app before.

giver avatar Feb 17 '14 10:02 giver

Indeed, it is weird. I fixed some issues with the localized strings in the last version (0.4.1). Can you try with this version? Otherwise, have you tried to print the [[NSBundle mainBundle] preferredLocalizations]?

yannickl avatar Feb 17 '14 22:02 yannickl

@YannickL Sorry my fault, I tell you the wrong version. Currently, I use YLMoment (0.4.0). I install it via Cocoapods

Before: YLMoment (0.3.0) -- No problem After: YLMoment (0.4.0) -- Problem here

[[NSBundle mainBundle] preferredLocalizations] // --> en

giver avatar Feb 18 '14 03:02 giver

@giver Are you using Cocoapods or have you installed the library manually?

What happens if you manually set the locale? E.g. [[YLMoment proxy] setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US"]];?

yannickl avatar Feb 18 '14 11:02 yannickl

@YannickL

Not working

[[YLMoment proxy] setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US"]];
YLMoment *moment = [YLMoment momentWithDateAsString:time format:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"];
_timeLabel.text = [moment fromNow];

Working code (I must specific locale)

YLMoment *moment = [YLMoment momentWithDateAsString:time format:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ" localeIdentifier:@"en_US"];

giver avatar Feb 24 '14 02:02 giver

@giver I'll do some test tonight to see if I can find the prob.

yannickl avatar Feb 24 '14 13:02 yannickl

@giver I updated the code. Can you tell me if everything is ok now please?

yannickl avatar Feb 24 '14 21:02 yannickl

@YannickL It doesn't work. I'm not sure if there is some code or environment configuration that make the things mess up.

giver avatar Feb 27 '14 02:02 giver

@giver Very strange, the test on my local configuration works. Is it possible to have a sample project which reproduce the issue?

yannickl avatar Feb 27 '14 11:02 yannickl