1

I have an app written in PHP with MySQL in the back. Originally the app was using custom language class that was quite ineffective so I changed everything to use gettext. The problem is a lot of strings are in the database, stored in tables that are never changed just read from. The good thing is every installation is in only one language.

In order to provide the strings in different languages, different databases were used before. There is database_en, database_fr, etc. and every new installation is using the appropriate localized database. I want to change this - one database for all languages.

I am thinking of moving everything language specific from the database to config files where gettext can be used again.

Do you think this is good idea or you would continue using different databases for different installations? Can you recommend something better ?

DanMan
  • 11,323
  • 4
  • 40
  • 61
gotha
  • 489
  • 1
  • 5
  • 20
  • 1
    It depends on how much and how often your project changes/evolves. Having multiple databases when developing new functionality adds you extra work and may bring extra errrors. So usually it is more clean to have just one database for multiple languages but depends a lot on the character of your project. Do not think there is one clear and right answer to this question, see http://programmers.stackexchange.com/questions/143578/localization-in-php-best-practice-or-approach. – Vojtěch Dohnal Dec 14 '14 at 10:12
  • What kind of text is it? Long, article-like texts or short snippets of just a few words max? I personally handle those differently. – DanMan Dec 14 '14 at 11:29
  • @DanMan Absolutely valid question. The longest text is about 100 words, most of the strings are just 1-2 words. I am thinking if it reasonable to store them in the database at all since even if I load everything in the memory (from files) it may be faster than doing joins. – gotha Dec 14 '14 at 16:34
  • @DanMan I don't think this is a dupe of the linked question, since the linked question presumes that the translations will be stored in an SQL database and this question is explicitly considering alternatives to that. (*Possibly* this deserves to be closed as "too broad" or "primarily opinion based", though; I'm on the fence and inclined to leave it alone.) – Mark Amery Dec 15 '14 at 00:22

1 Answers1

0

I recommend using google translation api at front end and single database for all with unicode data types.

Muhammad Muazzam
  • 2,810
  • 6
  • 33
  • 62