Reputation: 2119
I've found several databases out there, but none satisfies my needs.
Everywhere I looked had the country name written in english or some other language, but I need the country name to be written in the language of the target country itself.
For instance, I'm from "Brazil", but I need a database that the name it's written "Brasil", because that's how we call it here.
I'm preferably looking for a SQL database, but anything will do.
Upvotes: 1
Views: 339
Reputation: 1059
I've recently created a database for countries. However, it may not satisfy your requirement of having names in the target country's language. Here's the link anyway.
Upvotes: 0
Reputation: 23270
I suggest, you to checkout this GitHub repository:
https://github.com/turalus/openDB
Upvotes: 1
Reputation: 3885
What you should do is have a country table such as:
create table country (
country_id integer
, country_name varchar(255)
, /* any other columns you want */
)
;
And then have a country translation lookup table like this:
create table country_translation (
country_id integer /* make it a foreign key on the country table pk */
, language_id integer /* make it a foreign key to a language table */
, country_translation varchar(255)
);
Then in your query you do something like this:
select coalesce(t.country_translation,c.country_name) country_name
from country c
left join country_translation t on t.country_id = c.country_id
and t.language_id = ? /* whatever language you feed it */
Then it will pull up the translated version dynamically based on the input language_id in the query, or will return the standardized english version.
Upvotes: 1