Questions tagged [php-gettext]

php-gettext is a library for emulating gettext (a widely used framework for internationalization) in PHP.

Gettext is a widely used framework for internationalization. The php-gettext library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

81 questions
1
vote
2 answers

How to translate a string containing multiple plurals?

I want to translate a script that lists the content of a folder. There's a summary of included files, folders and the total size displayed. So far I translated all strings using gettext, but I'm stuck here and look for an elegant way to solve…
idleberg
  • 12,634
  • 7
  • 43
  • 70
1
vote
1 answer

PHP: Localizing string containing variables

So far I had no problems localizing strings with gettext, not unless strings contain variables. I followed the steps from this excellent tutorial, but whenever I try to apply this on this function, I'm running into trouble. /** * @…
idleberg
  • 12,634
  • 7
  • 43
  • 70
1
vote
1 answer

Gettext translating in English but not in French

so the issue is the following. I am converting a site from a content array for each language to a gettext site with 2 additional to the original languages. So my base language is es_MX and I have en_US and fr_FR translations. I use the following…
Mihail Minkov
  • 2,463
  • 2
  • 24
  • 41
1
vote
2 answers

php gettext not translating at all on Network Solutions server

I am having a strange problem with gettext on a server I am forced to use to redesign a website. The customer is used to having Network Solutions as provider so currently it's not an option to change providers. Anyway the problem is the…
Mihail Minkov
  • 2,463
  • 2
  • 24
  • 41
1
vote
0 answers

PHP `gettext` not working in Ubuntu

I'm trying to use PHP’s get text to add multilanguage support to my website. Unsuccessful so far, and I have no idea why. In my i18n.php file I have this:
André Fratelli
  • 5,920
  • 7
  • 46
  • 87
1
vote
2 answers

What PHP needs to work with gettext?

I have a linux server with PHP. I do not see gettext in the PHPINFO output, so I assume gettext is not enabled or included in the PHP. I have installed the gettext lib on the machine. What other steps do I need to do to enable gettext in my PHP? I…
Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278
1
vote
1 answer

Using gettext in a php project - Only one language translated

I am trying to translate a webpage to several languages. However, I can only make gettext work for spanish. I am using this code: $lang = "de_DE"; if (isset($_GET['lang'])) $lang = $_GET['lang']; putenv("LC_ALL=$lang"); setlocale(LC_ALL,…
user2348684
  • 361
  • 4
  • 17
1
vote
1 answer

php gettext fails loading html tag

I'm using gettext to translate my website. One key has a translations with a html tag: msgid "BANNER_TAG_START" msgstr "" if I use this code in php now: var_dump(htmlspecialchars(gettext('BANNER_TAG_START'))); it normally…
MaxiNet
  • 1,008
  • 2
  • 14
  • 22
1
vote
2 answers

how to save facebook access token after success

when user allow my app i receive this type of success url: http://localhost/fbapp/app.php#access_token=AAAAALY8OpPABAM67auStdfgdfOdfgdfgdenqEt9QZCGD2a1h3iWFrhmNWqOf8l4a9RQ8tAJCM9y5QbYpsP6sT1g0ZCXDhtZCECZApGb&expires_in=6604 i am trying…
0
votes
1 answer

Does gettext slow my PHP application down?

Does anybody know if the standard php gettext does slow down the web application? If the .po file always had to be read, it would get really slow I guess. So I thought the technique used might be different (Caching? How does it work?). Could…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
0
votes
0 answers

How to re-generate `.po` file by copying already translated ones

I already generated a .po file and translated it, the problem is the theme structure has changed at some files and needs a new .po file. How to re-generate a new .po file, but by copying already translated strings to it?
Jozefini
  • 173
  • 1
  • 11
0
votes
2 answers

E: Unable to locate package php-gettext

running OS: Ubuntu 20.04.4 LTS on Digital Ocean Droplet mysql: 8.0.29-0ubuntu0.20.04.3 php: 8.1.5 I followed this tutorial on installing phpmyadmin:…
0
votes
1 answer

PoEdit doesn't recognize php dgettext function

How can I configure PoEdit to recognize PHP dgettext function ? Note that I know about the Configure->Keywords part, but how am I suppose to indicate that the translation is in the second parameter of the function ? Anyone got poEdit work with…
FMaz008
  • 11,161
  • 19
  • 68
  • 100
0
votes
1 answer

Ubuntu 20.04 PhpMyAdmin error 500 with php7.0 - caching_sha2_password]

When I am using php version 7.0 with Ubuntu 20.04 and try open: http://localhost/phpmyadmin/ - then: HTTP ERROR 500 appers. When I try open any other page which connect with database, there appears: "Message: mysqli::real_connect(): The server…
workhard
  • 3
  • 1
  • 2
0
votes
3 answers

How to use compiled gettext .mo files without the gettext module?

I'm trying to find a way to use gettext and friends without depending on the official gettext module, which I've found to not be installed everywhere and sometimes yields different results depending on the OS and server configuration.
Kendall Hopkins
  • 43,213
  • 17
  • 66
  • 89