Adding localization with language identifier to an ipad app - objective-c

I'am coding an iPad app using Xcode. I use Base Internationalization for Storyboards.
So far, I have successfully added many languages, French, English, Spanish.
When trying to add Romanian using Xcode, the process is exactly the same, except the proposed language code is a little bit longer: ro-RO, where French is fr and English en and Splanish es.
No problem so far.
When running the app on the iDevice, I change the system language to Romanian, but my app will keep the last language set, whatever I do.
I suspected something about the longer language code. I've been using git diff to figure out what changes Xcode makes to project files when adding a language support. I see nothing anormal.
I noticed the same with Portugese, wich is pt-PT, so I think the bug has something to do with locales containing a language identifier (_XX).

I suspect that XCode supports language-country codes, even though iOS devices can only work with language codes. The easiest way to fix this I think is to close XCode and go to the Finder, and change the folders "pt-PT.lproj" to "pt.lproj" and "ro-RO.lproj" to "ro.lproj" etc.
Also see this related question: Cannot load country-specific resource

Related

Modern language IDE similar to QBasic?

I'm trying to find a modern environment similar to what I found great about QBasic but making up for the flaws. The purpose of this is to code with my 6 year old son.
I'm looking for an IDE that uses a modern language, has the ability to draw graphics and play audio, and doesn't force the User to jump around much between coding and running their application.
In QBasic you had basically two modes: Edit and Run. There were no third party libraries required for creating graphics or generating Audio tones (that I remember). You never had more than one "window" opened at a time.
Is there a modern day equivalent IDE which uses a modern language that provides what I'm looking for?
I don't want him to have to jump around between various windows, try to wrap his mind around window toolkits, understand the command line, or use OOP just to get started. My end goal is to create simple graphical games with him -- not printing text out to the console.
(Preferably cross platform or useable on Mac OSX since that's what we have at the house. Preferably Python based since that's my language of choice.)
QBasic is a great option. You can purchase an old PC from a thrift store and run QBasic on it. There is the option of QB64 which can run on both Mac and Windows. Hope this is helpful.
I'd suggest QB64, almost 100% compatible with QBasic/QuickBasic but runs on Windows.
You could maybe try Small Basic, it aimed to recreate the ease-of-use and educational purposes of the old BASIC languages build into home computers from the 1980s
The Small Basic project was initiated following this article on Salon:
Why Johnny can’t code (David Brin, 2006)

Building Air Apps (Desktop) with Haxe - Steps

I'm a developer in ActionScript and while I'm watching Haxe as a language to be used by me, since besides the resemblance ActionScript, still be possible to make applications with output to flash yet.
However I have a question about building AIR packages. When I search about building AIR applications with Haxe, the search does not bring satisfactory results.
I ask, after the codification and development of the code (in Haxe), how is it possible to transform what was built into an AIR package?
Thank you!
It isn't a very popular topic it seems. Anyhow, as far as I remember my experience building it some years ago, what you need would be:
If you need some air-specific APIs then you should write externs for them. There is this existing project, but it would need a bit of update as it was written for flash9, however, I believe it is doable in like 1 hour of work.
Compile to flash.
Write all the manifests you need for Air. (Sorry, don't remember what exactly it needs.)
Use this guides to package(also test and sign) your apps.
Note: If you want to go the same way you did before, you could compile haxe to as3 and be happy. However, I wouldn't recommend this method due to loosing speed and probable implications which may arrive.

A possible bug in NSSpeechSynthesizer?

I am writing an OS X application which uses NSSpeechSynthesizer to read text to the user and highlights the word it is reading in the text field (NSTextView). This is done by implementing the speechSynthesizer:willSpeakWord:ofString: method of the NSSpeechSynthesizerDelegate protocol. This method provides the range (NSRange) of the word it is about to speak which I forward to the setSelectedRange method of my NSTextView.
All is well until I stop the reading with the stopSpeaking method. If I set it to read again after this, the ranges provided by speechSynthesizer:willSpeakWord:ofString: seem to be out of sync. It seems that it hesitates calling speechSynthesizer:willSpeakWord:ofString: for a few seconds resulting in the ranges being somewhat behind the speech when it finally does.
I have written a simple application illustrating the issue, which can be found here:
http://dl.dropbox.com/u/12516679/SpeechTest.zip
I hope that someone will look at this code (it really is simple) and either confirm that this indeed seems to be a bug, or (hopefully) tell me what I am doing wrong.
- UPDATE -
It turns out that the problem occurs with non-english voices. I was originally using Ida, which is a Danish voice. I have now tested it with many different voices and I can confirm that it works well with all English voices. However it fell out of sync with Danish, Swedish, Norwegian and Dutch. It probably affects other languages as well, but these are the ones I have tested so far.
Ok, I have found the source of the problem and a workaround. It has nothing to do with the language as such, but the fact that most non-English voices in OS X Lion are Nuance voices (made by Nuance Communications). I have confirmed this by testing with English Nuance voices and they indeed have the same problem. It looks like there is something wrong in the api for voices provided by Nuance.
I have created a workaround for the problem by instantiating a new NSSpeechSynthesizer object after the reading has been stopped. It’s not pretty but it works :)
It is a bug, but it has been solved in the update of the Nuance voices for Mountain Lion.

User-controlled NSLocalizedString interface changes

I am working on an app that has strings files for all the UI text. Depending on their language in the iPad international settings, they will start up with their chosen language on all the UI elements.
I want to add the ability for the user to change this within the app, so they could choose from the supported languages and the app would update the UI to the new choice. This way we could set up a kiosk where tourists can select their own language without assistance.
I'm not sure whether I should use NSLocalizedString:withTable: and pull the strings files into en.strings, zh.strings (instead of en.lproj/Localizable.strings) but that seems like a lot of unnecessary work.
Is there a way to use NSLocale to set the user language for the app and still use the NSLocalizedString() call?
There was an excellent answer to exactly this question in another thread:
Tutorial and example code for changing localization strings during app use
Seriously, go and upvote this guy. It is a shining example of the best SO has to offer!

What's the best way to use vim for Cocoa development?

First time poster, long time reader. I searched and found no questions that answered this question. If I missed a thread somewhere I apologize.
I've been looking at doing some serious Cocoa development for a few years now. Even attended WWDC back about 5 years ago. With the App Stores making things easier for distribution I figured now is about as good of a time as any.
There's also been a fair amount of discussion regarding Vim lately and how it can increase productivity once you get a good handle on it. So I've purchased a couple books on Vim and bookmarked a dozen or two websites that I've seen lately.
My question is what plugins or whatever could I use with Vim to make developing with Cocoa/ObjC better?
I'm familiar with the Cocoa.vim plugin, but looking at the site there it hasn't been actively worked on for around 10 months. Before I get used to the features in that plugin I'd rather look at alternatives that have seen more development (if there are any).
That said, I'm interested in any and all tips regarding Vim and Cocoa/ObjC. Any easy ways to integrate them? I know you can set MacVim as the default editor in Xcode. What else might someone be able to do? Doing a Command-R to build&run would be great (Cocoa.vim claims to do this), but again, lack of development makes me cautious.
Thanks,
gks
Install the XVim plugin for Xcode. It gives Vim-like key bindings to Xcode.
I start using Vim one month ago, so I'm not a master but I'm quite familiar now.
As a Cocoa developer, I've been also looking to integrate things better, but until now, even with cocoa.vim I think Xcode still better for "application development". With this expression, I mean developing the easy part, that is logic like designing controllers.
You may agree with me. That's the easy part. Writing IBActions and so on. We don't need many editing commands to do that, and Xcode has a lot of advantages here. The auto-completion is phenomenal, it's intelligent and reads what you have been typing like no other. And can you imagine things with Xcode 4? Dragging an outlet from the interface directly into code is something that will not be available in Vim in a recent future.
Now, when it comes to writing models with heavy logic and C things, I stick with Vim.
You see, I still need to learn a lot. I'd love to have Vim running in the exact place of Xcode editor, but while that doesn't happens I have been trying to get the best from both worlds. Xcode is not all about editing text, it's about developing and debugging and many more, and it does these things in a fantastic way.
I'll let more experienced users continue…
I use vim for every text editing job except Cocoa. I agree with the things Sidyll says about the advantages of Xcode. Xcode is a pretty decent development environment with it's native editor.
I do have my Xcode set so that a double click brings up the file in Vim. I use this for things like fairly complex find and replace with regular expressions.
Another feature I'd like to see in Xcode is support for literate programing. In Haskell I can compile a file wih lhs suffix, and run the same file through Pandoc (or txt2tags) and get an HTML or PDF version. With Xcode I have to keep my development notes in a separate file.