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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:45:58+00:00 2026-05-13T05:45:58+00:00

So I started messing around with gettext but I’m still puzzled about certain things,

  • 0

So I started messing around with gettext but I’m still puzzled about certain things, would be great if anyone could help me out and fill in the gaps for me.

  1. Usually most of the implementations just invoke setlocale based on a language parameter. Is there any case in which I need to use putenv, perhaps for edge cases on Windows setups?

  2. The default language for my php framework is English, UTF-8 – so I’d set LC_ALL to en_US.utf-8, since en_US is ISO-8859-1/Latin1 and obviously that’s not as supportive as UTF-8?

  3. Are there any gotchas I should know about after invoking setlocale(LC_ALL, 'en_US.utf-8')? Since it changes all of these: LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME, and LC_MESSAGES – will I have to update any scripts for example, that generate time or something like that?

  4. Let’s say for example a freshly configured server did not have es_ES.utf-8 locale configured, I know how to generate the locale but if it wasn’t available then should I provide backups in an array? Would be great if someone could provide a practical example, like:

    setlocale( LC_ALL, array('es_ES.UTF-8', 'es_ES', 'es') )

    Is there some sort of website that offers examples such as this, or do people usually come up with the priority ordering themselves?

  5. I read somewhere that the usual structure of the locale or i18n folder is something like below.

    Does the structure really matter? It seems like all that’s happening is when you do bindtextdomain('messages', 'locale') it recursively searches that directory for messages.mo, I might not be noticing but it might be taking the directories into account.

How strict should I be with the structure?

locale
  en_US
      LC_MESSAGES
         messages.po
  es_ES
      LC_MESSAGES
         messages.po

   6.  Should I even bother with trying to test whether the system actually supports the locale or not? Because for example, if a server didn’t have a locale and I attempted to set it with setlocale it wouldn’t error out or anything, it would just silently let it go by.

  • 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-13T05:45:58+00:00Added an answer on May 13, 2026 at 5:45 am

    This is not a qualified answer to your question, and I’m not saying using gettext is bad – I never worked enough with it to have a really deep opinion on it – but I decided to leave gettext alone because of its complexity and massive unpredictability on different platforms with different locales. I posted a question looking for alternatives here and while there is not really much around, the Zend_translate package seems to be worth a look. I haven’t got around to it myself yet.

    If you work with gettext, be sure to check out the PHP Manual User Contributed Notes on Gettext.

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

Sidebar

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.