leverdeterre / LanguagesManager

An easy way to control manually the language in your application
MIT License
62 stars 11 forks source link

LanguagesManagerLanguageDidChangeNotification is earlier than set value of self.currentLanguage #6

Closed snakewa closed 10 years ago

snakewa commented 10 years ago

In this case, I cannot know the latest current language

leverdeterre commented 10 years ago

Hi snakewa, Can you clarify the problem ? a use case ?

snakewa commented 10 years ago

I have created a pull request: https://github.com/leverdeterre/LanguagesManager/pull/7

Because the notification is posed before setting the latest value of lang to [LanguagesManager sharedInstance].currentLanguage.

This is because the notification is trigger by setBundle:(NSBundle *)bundle

So this is a quick fix that to call setBundle: after setting the latest value to self.currentLanguage

Or is it possible to provide the language value using notification's userInfo ?

if (self.notificationIsEnable) { [[NSNotificationCenter defaultCenter] postNotificationName:LanguagesManagerLanguageDidChangeNotification object:@{"newLanguage":language}];
}

leverdeterre commented 10 years ago

I have merged your pull request :+1: Thanks for your job