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 8097979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:55:50+00:00 2026-06-05T21:55:50+00:00

Need just a push in the right direction with this. I’m building a multi-language

  • 0

Need just a push in the right direction with this.

I’m building a multi-language website in PHP and JavaScript. When using javascript (AJAX) to send comments/messages to the database I need to show a Success or Error message to the user. Because of using 3 different languages, I’m writing the code on each page where I use the code and using PHP language variables to translate the success/error message.

Everything works fine, but when a user looks into the source of the page he will see a long list of functions I’m using for different things on the website.

I would like to include everything in a JS file:

But then the PHP language variables wouldn’t work.

The only thing that comes in my mind right now is making different JS files with different languages:
myjs_en.js

myjs_fr.js

myjs_nl.js

And checking which language the user has chosen, including one of the 3 files.

Or is there some other option I can use for this?

Thanks for the help!

  • 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-06-05T21:55:52+00:00Added an answer on June 5, 2026 at 9:55 pm

    You would probably be best off providing language support from the server side. If you would like, the Zend_Translate component of Zend_Framework can be used as a standalone library.

    According to the documentation:

    “In multilingual applications, the content must be translated into several languages and display content depending on the user’s language. PHP offers already several ways to handle such problems, however the PHP solution has some problems:

    • Inconsistent API: There is no single API for the different source formats. The usage of gettext for example is very complicated.

    • PHP supports only gettext and native array: PHP itself offers only support for array or gettext. All other source formats have to be coded manually, because there is no native support.

    • No detection of the default language: The default language of the user cannot be detected without deeper knowledge of the backgrounds for the different web browsers.

      Gettext is not thread-safe: PHP’s gettext library is not thread safe, and it should not be used in a multithreaded environment. This is due to problems with gettext itself, not PHP, but it is an existing problem.

    Zend_Translate does not have the above problems. This is why we recommend using Zend_Translate instead of PHP’s native functions. The benefits of Zend_Translate are:

    • Supports multiple source formats: Zend_Translate supports several source formats, including those supported by PHP, and other formats including TMX and CSV files.

    • Thread-safe gettext: The gettext reader of Zend_Translate is thread-safe. There are no problems using it in multi-threaded environments.

    • Easy and generic API: The API of Zend_Translate is very simple and requires only a handful of functions. So it’s easy to learn and easy to maintain. All source formats are handled the same way, so if the format of your source files change from Gettext to TMX, you only need to change one line of code to specify the storage adapter.

    • Detection of the user’s standard language: The preferred language of the user accessing the site can be detected and used by Zend_Translate.

    • Automatic source detection: Zend_Translate is capable of detecting and integrating multiple source files and additionally detect the locale to be used depending on directory or filenames.”

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

Sidebar

Related Questions

I've just started a project and need a little push in the right direction.
It's a big question but I just need a push in the right direction.
I have just heard that - push notification is possible in iPhone I need
I have a big problem with git-svn: I need to just push my git
I need just one callback at the and of multiple callbacks. With a simple
I need just dictionary or associative array string => int . There is type
Really need just some guidance : Topological sort by arcs definition (from my question)
I'm quite new to develop on GAE. Need just sort out few questions about
first of all, I'm really thankful for all your help. I need just one
I just need a help in configuring hiberclipse for my eclipse indigo version. Install

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.