onesky / plugin-ios-ota

Over the air plugin
50 stars 8 forks source link

Not finding any of my keys... #20

Closed winterized closed 8 years ago

winterized commented 8 years ago

Hi,

I'm testing your OTA plugin for the first time in an iOS app (in swift, with the correct bridgers) and I'm facing a problem.

I managed to use this plugin to connect to the API without trouble, but when I try to get a value, the app fallback to my local localizable.strings file.

The code I implemented in my appdelegate is :

OneSkyOTAPlugin.provideAPIKey("my correct key", APISecret: "my correct secret", projectID: "163817")
OneSkyOTAPlugin.checkForUpdate()

Then, in my view controller, the line I'm trying is : print(OneSkyOTAPlugin.localizedStringForKey("planning.button.today", value: "Ajd", table: ""))

Here is the output to the console :

2016-07-11 17:19:16.254 EVHC[6011:1175866] OneSkyOTAPlugin - checking for update. 2016-07-11 17:19:17.022 EVHC[6011:1175866] OneSkyOTAPlugin - translations are up-to-date. 2016-07-11 17:19:23.348 EVHC[6011:1175866] OneSkyOTAPlugin - localized string not found for key: planning.button.today, locale: en, falling back to mainBundle Today

Yet, the key is correctly implemented on the platform. So I don't understand this error message.

I even tried to replace my original .csv file by all my .strings files but it seems it's not enough to make it work !...

Can you please help me with that?

bretdabaker commented 8 years ago

You should either specify the table name or use nil for Localizable.strings, but not an empty string ""

print(OneSkyOTAPlugin.localizedStringForKey("planning.button.today", value: "Ajd", table: "Localizable"))
2016-07-14 10:02:07.136 OTASwiftTest[51888:2445127] OneSkyOTAPlugin - checking for update.
2016-07-14 10:02:07.157 OTASwiftTest[51888:2445127] OneSkyOTAPlugin - localized string not found for key: planning.button.today, locale: hi-NZ, falling back to locale without region: hi
2016-07-14 10:02:07.157 OTASwiftTest[51888:2445127] OneSkyOTAPlugin - localized string not found for key: planning.button.today, locale: hi-NZ, falling back to development region language: en
2016-07-14 10:02:07.158 OTASwiftTest[51888:2445127] OneSkyOTAPlugin - localized string found for key: planning.button.today, value: Today, developmentLocale: en

You can also use this swift wrapper which replicates the ObjC macros.

public func OSLocalizedString(key: String, comment: String)