Localization / Multi-language Applications with PHP & MySQL

<?

I understand I will rewrite those two SQL queries this was until the app goes to production a proof of concept which will get refactored.
My own needs:
If I didn ’ t specify the version of the slug, the trouble with this is, it is going to fail. If You’d like to make sure a word is defined, this is fine but that I ’d rather have the program continue functioning so I battled those tables and Created the concept:

I had my languages table, so I added a couple more:

  • Easily expandable past two languages.
  • Willing to see the intent in my PHP code.

I’m working with an internet program which has to support multiple languages (lucky for me personally, the client asked English & Spanish but I need to be prepared to add another in the future).
FirstI did a little reading on localization (l10n) vs. internationalization (i18n) and if my need isn’t really “localization,” ” it’s close enough that’s exactly what I’m phoning it.
I had my languages dining table, so I added a few more:

  • Easily expandable past two languages.
  • Willing to read the intent in my PHP code.

$this->db->select(“wt.word”);
this->db->(“words_translated wt”);
$this->db->combine (“phrases w”,”w.word_identification =wt.word_identification”,”left”);
this->db->where(“w.slug”, $slug);
$this->db->where(“wt.language_id”, (int)$language_id);
$this->db->limit(1);
$query = $this->db->get();
if ($String = $question ->unbuffered_row(‘variety’))
return $row[‘word’];

// We did not get a game, so return the English variant reunite l10n($slug, 1);

<?

If the translation didn’t exist, then I could drop back to looking this up in speech ‘1’ (English) and return .

To begin with I did a little studying localization (l10n) vs. internationalization (i18n) and while my demand isn’t very “localization,” ” it’s ’s close enough so that’s what I’m phoning it.
Operate l10n($phrase, $language_id)
If I didn ’ t specify the version of this slug, the issue with this is, it is going to fail. If You Would like to make sure that a term is defined, this is fine but that I have the program continue working so that I came up with the concept also scrapped those tables:



I pass along the pure English term . The PHP function is as follows:

  • words
  • words_translated

Now, my PHP looks like:

This can be OK. I might look up the logo_alt_text’ in the language_id return and specified on the “word. ”
So I put inside and made MY_text_helper.php:

And I could write:

<? = l10n('Logo Alt Text', $language_id)?'

My requirements:

$CI =& get_instance();

$5 CI->load->model(‘Language_model’);
yield $CI->Language_model->get_phrase($phrase, $language_id);


Public purpose get_phrase($phrase, $language_id)

“words” contained a (unique) slug, where the translation has been stored at words_translated (I later switched from calling my translations “phrases” instead of “words). My PHP code would look like:

Return $word;

<?

I’m working on a web program which needs to support a number of languages (fortunate for me, the client requested English & Spanish however I want to be ready to add another in the future).

I am aware I will rewrite those 2 SQL queries into a single question; this is really until the app goes to production a proof of concept which can get refactored.
I didn’t need to have my own PHP code for this:

Function l10n($slug, $language_id)


So I added a couple more I already had my languages dining table:
And now I can write:
$CI =get_instance();

$CI->load->version (‘Language_model’);
return $CI->Language_model->get_phrase($phrase, $language_id);
}


Public purpose get_phrase($phrase, $language_id) {

Eventually , I didn’t need to have my PHP code like this:

<?

That is OK. I could look up the logo_alt_text’ in the $language_id specified and return the “word. ”

Operate l10n($slug, $language_id)