iOS - fastlane deliver, localized App Store description from strings file? - ios

I'm getting ready to have my app localized into other languages.
I'm using NSLocalizedStringWithDefaultValue to provide default English text within code, although I guess none of that maybe relevant.
I'm not adding localized text directly to nib or storyboards, everything is in my strings file.
I'll probably end up uploading those to a localization site.
So I'd like to use fastlane deliver to upload screenshots and meta data.
However I'd like to find a method where I can pickup values from my strings files.
So I guess my question is, how can I get my strings value into my deliver text file?
Or is there a better / quicker approach I should use?

Related

Can I programmatically change the text of the Localizable.strings file? [duplicate]

I want to be able to update localized strings by code from the app. What I actually want to do is to make changes to the localization on a server and then let the iPhone application fetch updated localization strings from a server and then save them to the localizable.strings file.
You can't ! Those files are part of the bundle and can't be updated. You will have to setup the whole translation framework by yourself (which is not that much work) and implement caching using either core data or serialized dictionaries (one for each language I suppose).
You won't be able to modify the Localizable.strings file in your app bundle because the app bundle is read-only on iOS devices. To grab localized strings from a strings file in your app's Library directory, you could programmatically create a bundle at that location, put a Localizable.strings file in it and then grab the localized strings with NSLocalizedStringFromTableInBundle(). (I haven't tried this but it should work.)
There's service (Get Localization) that allows you to upload those .strings files to server and fetch them via API. However there's no client for iPhone yet but it would be quite simple to do. You can contribute one or then wait that there's official available.

iOS App Localisation Best Practices And Placeholders

We're currently at the stage of looking at localising our app in to multiple languages now that the general concepts of the app have been decided. This is something I want to ensure is done correct from the start to lower the risk of headaches in the future.
The app targets iOS 7 and above, uses storyboards, and is written in Swift.
Storyboards
When working with a storyboard (or a xib), what's the best way to mark a UI element as "not to be translated"? For example, I have a placeholder string for a user's display name (Display Name), which will be replaced by a users display name at run time. This display name will not be localised, but neither should the string "Display Name". Is there a method of not having a UI element's value automatically put in to the strings file? If not, is going in to that file and manually removing strings I don't want localising a sustainable option?
Strings In Code
I'm using the Swift function NSLocalizedString with the key and comment parameters. Some places I've seen say to set the key to be a unique id based on the context (e.g., intro.login-button-text), while others seem to just put the full string in the default language (e.g., Login). I like the idea of the unique ids for the key, but would this not go against the idea of the "base" language?
Exporting
Xcode 6's "Export For Localization" option seems very useful for getting the correct format of file to be sent to translators. However, as mentioned previously, placeholder text does not need to be translated. Should these placeholders be removed from the exported xliff or the strings file prior to export?
Looking for the the same questions myself. Hope this will help you and others. Also I would recommend to have some kind of tool to organize the xliff/string files
Storyboards:
I've seen developers putting non translating texts in storyboard with extra parentheses. i.e. {Display name}.
By using this you can see by the translation itself if it needs to be translated or not. We use oneskyapp.com and can select to hide those translations and they will be hidden for each import of that key.
Strings in Code
By following this thread they suggest to use keywords.
Best practice for key values in translation files
Exporting
I cannot find a way to have some translations automatically removed when exporting. Off course you can put the views which has dynamic fields in different XIB/storyboards and decide not to translate those.
Again a tool like onskyapp.com can help you with this.
Formats
As of context with the field is important and a translation can be different when it is followed by i.e. a users name I would go for "%1$# is online!"

Is there a clever way to pass a yml locale file to my client for translation?

I have finished a rails project using i18n and now I need to pass all the text in the website to our client so that he can translate them and we can include additional locales to our app.
The problem is our client is not a geek and if we give them the actual YAML file, they will use MS Word to edit it and we'll lose all the proper markup in the process ("\n" for new lines, one line text, etc...).
How would you handle this process?
Is there a better way than giving the client a .doc file and then loosing a day to clean the text afterwards and manually converting it back to YAML?
Thanks in advance,
Augusto
This is exactly what Locale was created for : you upload your YAML files, your client/translator edits the content and you sync YAML back down. You don't email files and you don't have to deal with crappy file formats - check it out!
Full disclosure : I co-founded and develop Locale.
This sounds like a one-off thing where I you do the translation once and then be done with it.
What we do in these cases (we usually work with a Translator for these kinds of things) is that we export all the keys in the YAML to Excel and send them that.
Once we get it back we usually task a intern with fixing up the yaml (after it's been translated back into YAML - we do this manually at the moment but a little script should be easy to implement)
Other solutions could be (if you do this a lot) that you include the translations into your app and enable through some JavaScript and maybe something similar to Aloha Editor the user to simply click on texts and translate them in the app. But that's a bit excessive and only makes sense if there are really a lot of translations to be done and you want to crowdsource them (Facebook did this back in the day)

Custom file types with iOS Document Interaction Programming

I understand the basic of Document Interaction Programming and UIDocumentInteractionController and I've got it working in my app. However I'm having trouble with specific details of using custom file types. I can't find this addressed in the Apple docs anywhere.
My app uses it's own file types with unique extensions. The files themselves are just plists (xml), but I want the device to treat the files as only openable in my app. Originally I implemented the Document Interaction stuff to treat them as XML while I got it working, but now I want it to treat them as binary files that it needs to hand off to my app.
At the moment, if you have one of my files in an email attachment, iOS first shows the QuickLook (which just spews all the text content of the xml out) before you can choose to Open In. Similarly if one of my files is opened with Safari, Safari just shows the XML and doesn't give you the option to show it in my app at all.
So how do I get iOS to not treat my files as XML? I've changed the "Conforms to UTI" value and "public.mime-type" value in the info.plist, but it seems to have no effect.
Any tips greatly appreciated.
As far as i understand the UIT concept of Apple you cannot just change the file extension to change a potential UIT of the file. If the file contains XML-Data, other apps as well as internal apps might recognize your content and show it internally as XML.
Try to store your Plists with NSPropertyListSerialization NSPropertyListBinaryFormat_v1_0 (then you readble XML)
When you did that without success, why not trying this:
use zlib to compress the XML plists afterwards to a zipped file.
make a "unique" file extensions (<file>.myappname)
this should "hide" other apps and quick view.
Tell me if one of the ways did work for you.

How to localize the app name?

I wrote a game with cocos2d and translated all the image and text in the
game in two different language.
When the app launches, I load different resource according to the locale of
the device and this worked all OK.
Then when I upload this app for review, I first named it say "test".
Then in the localization part I add a language "Japanese".
But I found that in the "Japanese meta data part", I can edit a lot of
things except the "app name" which is "test". But I want my app to show
different names according to the locale of the device also.
Can somebody tell me how to get this work? Thanks in advance...
You can create a file called InfoPlist.strings in each of your language specific directories, and set a language specific value for CFBundleDisplayName.

Resources