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

  • Home
  • SEARCH
  • 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 5939207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:47:38+00:00 2026-05-22T15:47:38+00:00

The following example works on Mac OS X with Apache, i.e. I get the

  • 0

The following example works on Mac OS X with Apache, i.e. I get the translated string echoed back. But on Ubuntu with lighttpd I get the original text ‘Inactive account’. I’ve tried all sorts of combinations of environment varialbes without any luck. It’s not file permissions either because I can echo out the contents of the .mo file.

<?php

//$locale = 'sv_SE.UTF-8';
$locale = 'sv_SE';

$dir = dirname(__FILE__);

// File permission is apparantly not a problem as this works...
//echo file_get_contents($dir . '/sv_SE/LC_MESSAGES/flattr.mo');

putenv("LANG=$locale");
putenv("LANGUAGE=$locale");
putenv("LC_ALL=$locale");
putenv("LC_MESSAGES=$locale");
setlocale(LC_ALL, $locale);
setlocale(LC_MESSAGES, $locale);
//setlocale(LANG, $locale);
//setlocale(LANGUAGE, $locale);

bindtextdomain('flattr', $dir);
//bind_textdomain_codeset("flattr", 'UTF-8');
textdomain('flattr');

echo _("Inactive account");

?>

Anyone have any ideas?

  • 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-22T15:47:39+00:00Added an answer on May 22, 2026 at 3:47 pm

    I was facing the same problem. I’ll describe the things I did to fix it on Ubuntu 10.10.

    1) make sure you have ‘gettext’ installed,

    sudo apt-get install gettext
    

    Alternatively, you can install ‘php-gettext’ if ‘gettext’ cannot be installed. The package ‘php-gettext’ is not required if you already have ‘gettext’ installed.

    2) Then generate the locale for your language. In this example I’ll use ‘sv_SE’. Look up the supported locales in ‘/usr/share/i18n/SUPPORTED’,

    less /usr/share/i18n/SUPPORTED
    

    You’ll find multiple lines that start with ‘sv_SE’,

    sv_SE.UTF-8 UTF-8
    sv_SE ISO-8859-1
    sv_SE.ISO-8859-15 ISO-8859-15
    

    This means you have multiple options for generating the locale for sv_SE. One of the options does not have a period (.) in its name (i.e. sv_SE ISO-8859-1); this is the default character set for that locale. To generate the locale for the default character set, run the following command,

    sudo locale-gen sv_SE
    

    If you want to generate that locale for the UTF-8 character set, run this command,

    sudo locale-gen sv_SE.UTF-8
    

    Restart Apache after generating locales (it won’t find the newly generated locales otherwise),

    sudo service apache2 restart
    

    3) Finally, update your PHP script to match the locale you generated. If you generated the locale for ‘sv_SE’,

    setlocale(LC_ALL, “sv_SE”);

    But if you generated the UTF-8 equivalent of that locale, use,

    setlocale(LC_ALL, “sv_SE.UTF-8”);

    All should work now.

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

Sidebar

Related Questions

The following example works in Firefox 4, but not in Internet Explorer 8: HTML:
The following example works, but how can I change it so that instead of
Can someone tell me please why the following example work in Firefox but not
Consider following example : public class SomeBusinessLayerService : DataService<MyEntityContainer> { [WebInvoke] void DoSomething(string someParam)
Let me use the following example to explain my question: public string ExampleFunction(string Variable)
I was trying the following example, but with external URLs: Using WebViews The example
It turns out that the following example works when using mysql 5.x, however it
The following RoutedCommand example works. However, the handling for the button which executes the
Roll with me and imagine the following example: Public ViewResult GiveMeFruit(int personId, string personName,
The following works fine on Mac OS X: #!/bin/bash R CMD Sweave myfile.Rnw pdflatex

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.