lang = 5 letters for Apple's Search API, am I missing something? - itunes-search-api

Apple's search API documents specify:
lang =
The language, English or Japanese, you want to use when returning search results. Specify the language using the five-letter codename. For example: en_us.
The default is en_us (English).
examples: en_us, ja_jp
However, I cannot find this 5 letter standard codename. Are they just expecting a ISO 639-1 Code concatenated with a 2 letter country code?
Has anybody ran into this issue before?

As you can see the document below, en_us, ja_jp is not a "example" but the supported values for lang parameter key.
https://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
This means, currently this api supports only these two langeages.
Hope this helps.

Related

Question about local SOURCE_LOCALE = "en" in Roblox

enter link description here
I wonder why SOURCE_LOCALE is in call caption and reason why it has underscore between them. I want to know what they are and how they work.
It is common to define constant values using all capitals. It is just a way to highlight a value that isn't intended to change. While Lua doesn't have technically have constants, this practice still shows up. Also, underscores can be used in variable names.
And if you read further into the article, you'll see that the SOURCE_LOCALE is used alongside the LocalizationService :
function AnimateUI.loadTranslator()
pcall(function()
translator = LocalizationService:GetTranslatorForPlayerAsync(Players.LocalPlayer)
end)
if not translator then
pcall(function()
translator = LocalizationService:GetTranslatorForLocaleAsync(SOURCE_LOCALE)
end)
end
end
And there is a note that follows :
If your game's source language is not English, change the locale code on line 4 (en) to match the game's source language setting in the localization portal.
The point of this code is to automatically translate your message into different languages. en is used to define the English locale. Other language locales include es for Spanish, de for German, and a number of others.
If you want more information, consider reading the articles and tutorials on localization.

Google text-to-speech (Wavenet) Is there a list of date formats for each supported language?

Wavenet correctly converts dates like 01/02/2019 into a spoken date. Different languages use different date formats and separators e.g. dd/mm/yyyy and mm/dd/yyyy. Is there a list of date formats and separators for each supported Wavenet language?
Does Wavenet follow the country standard formats given in https://en.wikipedia.org/wiki/Date_format_by_country?
The great thing about Google's text-to-speech (as well as others, like Amazon's Polly) service is, that besides plain text that you seem to be using, it accepts SSML which stands for Speech Synthesis Markup Language. This allows you to provide XML tags to indicate how to pronounce certain parts of speech. Among them, dates:
<speak>
<say-as interpret-as="date" format="yyyymmdd" detail="1">
1960-09-10
</say-as>
</speak>
(Example taken from https://cloud.google.com/text-to-speech/docs/ssml#sayas)
As you surely know you can test this out directly in the browser here: https://cloud.google.com/text-to-speech/.

Unicode range mapping between languages

there is 7707 languages listed in this link http://www.sil.org/iso639-3/download.asp and http://en.wikipedia.org/wiki/ISO_639:a.
And also Unicode support the writing system of the languages, but i want to know mapping beetween the languages and unicode range.
Unicode range is listed in this link http://www.unicode.org/roadmaps/bmp/
Example one of unicode range : "start"=> "0x0900", "end"=> "0x097F", "block_name"=> "Devanagari" (what language use this range of unicode ?)
there is any documentation ? I need full languages mapping that are supported in unicode range.
You can take a look at ICU4C locale (http://icu-project.org/apiref/icu4c/uloc_8h.html)
You can get all the locales (with uloc_getAvailable), then for each locale call uloc_addLikelySubtags, and then uloc_getScript on the result.
This is going to give you the most likely script used by a language. But there are languages that use more than one script. Some of them are captured by ICU, but some are not.

Arabic translation for iPhone

What localization prefix do I use for an Arabic translation of the text for an iPhone application? For example for a French translation I use the prefix "fr" which creates a directory "fr.lproj". In actuality the lproj prefixes are the two letter country codes for the country. But there isn't a country for Arabic. So what localization prefix do I use for an Arabic translation?
I don't know about the iPhone specifically, but for Arabic it is typical to use "ar" as the prefix. If there are specific subsets, it has the form of "ar-XXX" but don't know what the possible XXXs are.
Generally, it is good to follow one of the ISO standards, I am guessing that if you use fr then you need ISO 639-1 and not 639-2. See this link.
BCP 47 definition for Arabic:
Type: language
Subtag: ar
Description: Arabic
Added: 2005-10-16
Suppress-Script: Arab
Scope: macrolanguage
Also here's a list of the Languages abbreviations in ISO 639-2 format:
ISO 639-2 language codes
I hope it helps.

Table query in iPhone app

I have a tableview (linked to a database) and a search bar. When I type something in the search bar, I do a quick search in the database and display the results as I type.
The query looks like this:
SELECT * FROM MyTable WHERE name LIKE '%NAME%'
Everything works fine as long as I use only ASCII characters. What I want is to type ASCII characters and to match their equivalent with diacritics. For instance, if I type "Alizee" I would expect it to match "Alizée".
Is there a way to do make the query locale-insensitive? I've red about the COLLATE option in SQL, but there seems to be of no use with SQLite.I've also red that iPhone SDK 3.0 has "Localized collation" but I was unable to find any documentation about what this means...
Thank you.
There are a few options for solving this:
Replacing all accented chars in the
query before executing it, e.g.
"Psychédélices" => "Psychedelices"
"À contre-courant" => "A contre-courant"
"Tempête" => "Tempete"
etc.
but this only works for the input so
you must not have accented chars in
the database itself. Simple solution but
far from perfect.
Using a 3rd party library, namely ICU (links below). Not sure if it's the best choice for iPhone though.
Writing one or more custom C functions that will do the comparison. More in the links below.
A few posts here on StackOverflow that discuss the various options:
How to sort text in sqlite3 with specified locale?
Case-insensitive UTF-8 string collation for SQLite (C/C++)
How to implement the accent/diacritic insensitive search in Sqlite?
Also a couple of external links:
SQLite and native UNICODE LIKE support in C/C++
sqlite case and accent insensitive searches
I'm not sure about SQL, but I think you can definitely use the NSDiacriticInsensitivePredicateOption to compare in-memory NSStrings.
An example would be an NSArray full of the strings you're searching over. You could just iterate over the array comparing strings using the NSDiacriticInsensitivePredicateOption as your comparison option and displaying the successful matches.