質問

my app is being localized and we are concerned with dialects. (ie. difference between spanish and spanish in peurto rico) I notice that just changing the region doesn't push a notification to the app that will trigger the localization.. only changing the language triggers this notification.

In my app delegate i would like to check to see if the region has changed in my applicationDidBecomeActive method and if it has, i'd like to push the notification that iOS would have pushed if the language had changed.. is that possible?

役に立ちましたか?

解決

Each time your app returns to the foreground (not when it becomes active), get the current locale. Compare the latest locale to the previous locale. If the new and previous locale are different enough for you, post the notification.

Example - going from Spain to Mexico should change the locale from es_ES to es_MX.

Edit:

To post the notification you can do:

[[NSNotificationCenter defaultCenter] postNotificationName:NSCurrentLocaleDidChangeNotification object:nil];

他のヒント

To programatically post the notification:

[[NSNotificationCenter defaultCenter] postNotificationName:NSCurrentLocaleDidChangeNotification object:self userInfo:nil];
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top