RandomWhiteTrash
RandomWhiteTrash

Reputation: 4014

One or more language files?

I18n question.

When using GetText PO files and site that has 2-3 semi-separate working areas (like frontend, backend and some special area):

  1. is it better to use one big file for all the translations (because some of those will inevitably repeat in all the areas)
  2. keep it separate by area at a risk of repeating translations

Benefits of approach 1 are clear - less stuff to translate. Benefits of apprach 2 are possibly better performance/less resources used?

Can anyone shed some light on the issue? We would like to minimize amount of translations work, but then again we dont want to sacrifice too much performance.

PS. Site is written in PHP and hosted on a LAMP.

Upvotes: 0

Views: 61

Answers (1)

Vlad Preda
Vlad Preda

Reputation: 9910

In general, the best approach is to create one "master" translation file, where you have the most general and used translations.

Let's say that you could have all the translations for the header, footer and sidebar (even though not all your pages have a sidebar, if most of them do - it's fine).

After that, you can have separate translation files for each page.

This reduces the amount of duplicate translations, but also prevents you from loading the translations you don't need.

IMO it's a good compromise.

This also works great with javascript and css.

Upvotes: 1

Related Questions