Why AVSpeechUtterance.language cheating me? - ios

I am developing an app that has a text to speech feature. I also let the user to choose want language they want by changing the voice of the AVSpeechUtterance. The language is either American English (en-us) or British English (en-uk).
I tested the app by synthesising
Stack Overflow is a question and answer site for professional and enthusiast programmers
In the speech, I could clearly hear the -er in "answer". So it was American English. But I actually selected British English!
Then I selected American English and the same, exact voice is produced!
I thought this was because I didn't actually set the voice property to en-uk. So I added some breakpoints and check. It turns out that I did set it to en-uk!
Why is this? Is British English just not available? Or did I entered the locale wrongly? en-uk is not the right one?

Try to use en-gb. According to ISO 3166-1, "UK" is deprecated country code.

Related

Phonetic translation from Latin (English, German) to Arabic

I read a few papers about machine translation but did not understand them well.
The language models (in Google translate) use phonetics and machine learning as best as I can tell.
My question then becomes is it possible to convert an Arabic word that is phonetically spelled in English to translate the users intended Arabic word?
For instance the word 'Hadith' is an English phonetic of the Arabic word 'حديث'. Can I programmatically go from 'Hadith' to Arabic?
Thanks the Wiki article, there's an entire field of work in the area of Transliteration. There was a Google API for this that was deprecated in 2011 and moved to the Google Input Tools service.
The simplest answer is Buck Walter Transliteration but at first glace a 1:1 mapping doesn't seem like a good enough idea.
I am going to try to see if there's a way to hack the Google Input tools and call it even at CLI level because their online demo works very well

Localisation issue (Welsh)

OK so I have been working on an app that will be available in multiple languages.
I have managed to get it working in the main languages, such as French, German, Spanish and English.
I have also now managed to get the app to use different regions within a language such as en_GB, en_US etc etc so all is good - thanks to this guide:
http://hamishrickerby.com/2010/07/23/iphone-ipad-localizations-regions/
One of the most important languages for me is Welsh. Apple allows me to set my iPhone to welsh by choosing British English as my language and region format as Welsh (United Kingdom).
I have created the Welsh language localisation within my app and translated my bits but I don't seem to be able to apply it.
My idea was that if the users language was set to British English that I could have a button on the main view that would allow the user to chose Welsh. Is this possible and what would be the best way to implement it.
Ideally if the user has already set their language to British english and has the region format to welsh they will get the welsh language version of the app just like the french would automatically get the french language version and the spanish will get the spanish version of the app etc but as most welsh speaking users will have their phone set to United Kingdom as they are not aware of the Welsh Region setting in iOS.
I would like the app to detect if the current language is British English and display a button on the home screen where the user can switch to Welsh Language. I have managed to display this button (only if user language is British English) but have no idea how to link it to change the language?
Anyone have any ideas or maybe a suggestion on the best way to implement my goal.
Thanks in advance.
Unfortunately, as you've identified, Welsh isn't a fully supported language on iOS. Until Apple supports it properly, you'll have to implement a bit of a workaround.
It seems as though the main solution is to have both English and Welsh .strings files (like you would with other languages), but manually load the required language, using
[[NSBundle mainBundle] localizedStringForKey:yourString value:#"" table:#"Welsh"];
#"Welsh" could be another language there, depending on what you want to load. You'll have to implement some control within your app so that users can change the language themselves. Check out the example project linked to in this blog post by translation company Applingua - it shows one way of encapsulating this code into a language provider class.

Translation of iPhone App

I would like to localize my app (as suggested from Apple) to several languages like English, Spanish, French, etc...
Well I don't speak or understand all those languages, at least my translations look awkward to native speakers.
(Results from online translators are a first start but of course insufficient.)
So does anybody know a service/platform where I can get translations from human native speakers mutually.
For example:
I speak German mother tongue and need my app/text/website translated to English.
Some other guy might speak English mother tongue and needs his app/text/website translated to German.
So I could do it for him and he for me. Without paying money, but with high quality, because both have a benefit. Unfortunately I don't have a clue how to find this guy, do you have an idea? Is there a platform on the internet which could help out?
My google research did not get a valuable result.
I would suggest using a professional service, speaking a language does not mean you can do a good translation.
There are a few recommended vendors from apple:
https://developer.apple.com/internationalization/#vendors
I work for Supertext and we also do lots of app translations.

How do you find the country code from NSLocale preferredLanguages?

I am in the process of developing an iOS application that needs to tell the server it communicates with the current language being used on the iPhone/iPad. I am currently using:
[[NSLocale preferredLanguages] objectAtIndex:0]
However because the App is a word based game in the case of English being used (en) this is not enough to go on, I need to be able to distinguish between en_GB and en_US (and potentially other languages in the future).
Currently I have two ways of doing this:
1) Use the currentLocale setting to get the current country code of the device and combine that with the preferredLanguage, however this is rather hacky.
2) Roll my own page to allow the user to change the language in App.
I am leaning towards option 2 but it will involve a fair chunk of work.
My question is, is there a better way of achieving this?
iOS does include British English (en_GB), as opposed to US English (en), so in this particular example you could rely on the user's iOS language setting alone. If the user has selected British English and your application includes it in its list of localizations, then you should see en_GB using your line of code.
But of course, if you wish to support a language that iOS doesn't itself expose, you're stuck with having to provide your own picker.

Similar languages when submitting to Apple's AppStore

I am uploading a new App which is localized in 10 languages to the Apple AppStore.
Apple offers several languages with country specific options such as
Canadian French
Mexican Spanish
Brazilian Portuguese
We have set up localizations for French, Spanish and Portuguese.
On the iPhone, an App defaults to the closest language available. For example, an iPhone set to "Brazilian Portuguese" will use the regular Portuguese localization instead of the English default localization.
Is it the same on the AppStore? Do we need to also set "Mexican Spanish" or will customers from Mexico default to Spanish (instead of the defaulting to English)?
edit:
To clarify, this is not about whether we should localize to these dialects (we already decided against that when making the app), but whether the store page shown to the customer will be displayed in the closest dialect or english.
For example, will a Mexican user automatically see the Spanish version (the closest language) or the default language (English)?
I can confirm that the closest available language is selected by the App Store.
For example in the Mexican App Store if you have Spanish set up but not Mexican Spanish, Spanish will show up. This app has Spanish activated on iTunes but not Mexican Spanish and everything is in Spanish on the Mexican App Store.
https://itunes.apple.com/mx/app/id502222888
The language that is displayed on the App Store depends also on the user's language settings since they set the language query parameter. The URL format used by Apple with the language query parameter is:
https://itunes.apple.com/tw/app/id502222888?l=zh where tw is Taiwan and l=zh is the Chinese language.
The language query parameter is not always used.
For example in Germany, even if you set the another language via the query parameter it will be ignored and the German language will show up since it is the only language for that location:
https://itunes.apple.com/de/app/id502222888?l=fr
While in Canada that has both English or French, you can use the language query parameter:
https://itunes.apple.com/ca/app/id502222888?l=fr
To answer my own question: No, Apple does not automatically choose the closest language on the AppStore.
Here is an example of the Mexican AppStore using English despite standard Spanish being present:
Let's start with Spanish. As far as I know Spanish (Mexico) is considered International Spanish, which is fairly similar to English (USA).
I don't know about French, so I might be wrong here but I believe French (France) would be perfectly understandable by the Canadians.
As for Portuguese... Well, in this case you did something that I believe should be the other way round. I read on the Internet that Portuguese government (?) recently pass a reform so that regular Portuguese would be similar in terms of grammar with Brazilian Portuguese. You see as Brazil is much bigger country, Brazilian version is much more common. Therefore I don't think it is OK to use regular Portuguese in Brazil (there might be some problems) but it is probably just about right to use Brazilian Portuguese in Portugal.
There is also the case of Chinese. As in Simplified vs Traditional. If you ever going to localize your application into Chinese (not the easiest thing to do), Traditional is the one to be used in Hong Kong, Taiwan and Macao whereas Simplified is the one they use in China (mainland) as well as in Singapore.
It would be very inappropriate to confuse them (i.e. try to sell Simplified version to the Taiwanese).

Resources