Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 625569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:19:25+00:00 2026-05-13T19:19:25+00:00

This is the most optimal way of dealing with a multilingual website I can

  • 0

This is the most optimal way of dealing with a multilingual website I can think of, right now (not sure) which doesn’t involve gettext, zend_translate or any php plugin or framework.

I think its pretty straight forward: I have 3 languages and I write their “content” in different files (in form of arrays), and later, I call that content to my index.php like you can appreciate in the following picture:

alt text http://img31.imageshack.us/img31/1471/codew.png

I just started with php and I would like to know if I’m breaking php good practices, if the code is vulnerable to XSS attack or if I’m writing more code than necessary.

EDIT: I posted a picture so that you can see the files tree (I’m not being lazy)

EDIT2: I’m using Vim with the theme ir_black and NERDTree.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:19:26+00:00Added an answer on May 13, 2026 at 7:19 pm

    Looks all right to me, although I personally prefer creating and using a dictionary helper function:

    <?php echo dictionary("showcase_li2"); ?>
    

    that would enable you to easily switch methods later, and gives you generally more control over your dictionary. Also with an array, you will have the problem of scope – you will have to import it into every function using global $language; very annoying.

    You will probably also reach the point when you have to insert values into an internationalized string:

    You have %1 votes left in the next %2 hours.
    Sie haben %1 stimmen übrig für die nächsten %2 stunden.
    Sinulla on %1 ääntä jäljellä seuraavan %2 tunnin ajassa.
    

    that is something a helper function can be very useful for:

    <?php echo dictionary("xyz", $value1, $value2 ); ?> 
    

    $value1 and $value2 would be inserted into %1 and %2 in the dictionary string.

    Such a helper function can easily be built with an unlimited number of parameters using func_get_args().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure if this is the most optimal way of writing this code,
What is the most optimal way to achieve the same as this? void foo(double
What do you think is the most optimal way to retrieve all attributes for
Would you say this is the most optimal way of doing simple traditional logging
So, I'm in doubt to which way is the most optimal in the situation
This is most likely not an easy one but here is the situation: I
I've been working on this problem most of the morning and I think I
Advise me the most optimal way to save large files from php stdin, please.
I'm trying to find the most optimal way to return a recordset containing a
Possible Duplicates: Generating Random Numbers in Objective-C What's the most optimal way to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.