php-gettext

Gettext working intermittently

喜欢而已 提交于 2019-12-25 05:18:34
问题 I've managed to successfully enable internationalization and {% trans %} tag in twig using these lines: $language = "..."; $domain = "project"; putenv("LC_MESSAGES=$language"); setlocale(LC_MESSAGES, $language); bindtextdomain($domain, SITE_DIR . "locale"); textdomain($domain); bind_textdomain_codeset($domain, "UTF-8"); And twig template: ... {% trans "Translation.Key" %} ... Unfortunately it works randomly. I mean, while I keep pressing F5, say, every second, or going between pages,

php-gettext isn't working

試著忘記壹切 提交于 2019-12-24 19:03:30
问题 I'm trying to setup localization using php-gettext, but it doesn't seem to work no matter what. I have an index.php: <?php require_once "localization.php";?> <a href="?locale=en_US">English</a> | <a href="?locale=de_DE">German</a> <br> <?php echo _("Hello World!"); ?><br> <?php echo _("My name is"); ?> Bob. and the localization.php <?php $locale = false; if (isset($_GET["locale"])) { $locale = $_GET["locale"];} putenv("LC_ALL=$locale"); setlocale(LC_ALL, $locale); bindtextdomain("messages", "

How do you use gettext on server (Apache) you can’t restart?

谁都会走 提交于 2019-12-24 00:35:59
问题 I asked this question on serverfault but I didn't get any response. I try here... I developped a site on my web server at home. When I modify the translation files, I have to restart the web server Apache. /etc/init.d/httpd graceful Easy... Suppose that my site is hosted on shared host. Suppose now I need to modify the translation files. I can't restart the server... How do you use gettext in this context? Are you allow to restart the server with the option graceful only? Does the share host

Extract javascript gettext in Poedit?

自作多情 提交于 2019-12-23 05:45:07
问题 I have used "GNU gettext" with PHP and it did a greate job by using poedit I was able to extract the PO file format but when I tried the same thing for my javascript inside my HTML "script" tag I didn't work even more I can't see any javascript support. poedit support almost all languages except javascript or I am doing it In a wrong way can anyone provide working example for javascript?! i followed all example in almost 20 languages using poedit and all worked except javascript all working

how to save facebook access token after success

喜欢而已 提交于 2019-12-13 00:48:34
问题 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 $_GET['access_token'] to save access token, but it's not working, i want to know that how to get access token from this url.. 回答1: From your use of $_GET, I'm assuming you are talking about PHP. Unfortunately, hash tags are never sent to the server. They only

PHP Gettext: how to change the default MO path after setting the path of the domain?

霸气de小男生 提交于 2019-12-10 14:26:00
问题 I use PHP Gettext extension for localizing a Web app. When you do: bindtextdomain("example", "/locales"); If you're setting the locale to fr_FR, it will look for the MO in: /locales/fr_FR/LC_MESSAGES/example.mo Is there a way to customize that path? For instance I would like to use the following structure: /locales/example.fr_FR.mo 回答1: The directory structure is fixed by gettext. Because many different languages for many different packages have to be stored we need some way to add these

What is bindtextdomain, textdomain in gettext?

拟墨画扇 提交于 2019-12-07 03:33:50
问题 I've been learning a bit of gettext but I can't grasp those two functions. I've been wondering if I could use multiple translations in a APP written in PHP. For an instance, I've 1) the system translation 2) extensions translations 3) theme translations to divide those in different files. My question is, if I load the system translation, then load the theme translation will the first one be "unset"? I'd appreciate any links related to gettext and php. Thanks 回答1: You can readily swap between

What is bindtextdomain, textdomain in gettext?

[亡魂溺海] 提交于 2019-12-05 07:30:51
I've been learning a bit of gettext but I can't grasp those two functions. I've been wondering if I could use multiple translations in a APP written in PHP. For an instance, I've 1) the system translation 2) extensions translations 3) theme translations to divide those in different files. My question is, if I load the system translation, then load the theme translation will the first one be "unset"? I'd appreciate any links related to gettext and php. Thanks You can readily swap between textdomains whenever you like. e.g: Given ./locale/en/LC_MESSAGES/template.po with the contents msgid "foo"

Use PHP Gettext without having to install locales

只谈情不闲聊 提交于 2019-12-04 17:30:43
问题 I've been looking at options for internationalizing an open source project: Gettext, which everyone seems to recommend, apparently needs locales to be "installed on your system" to be used. See this note on the PHP manual, which reflects exactly my situation. This SO question also asks about the same problem. This isn't suitable for an open source project because I can't trust that the end users have the appropriate locales installed on their system. Besides, it's very very weird that you

Can't get gettext (php) on Ubuntu working

左心房为你撑大大i 提交于 2019-12-03 18:49:32
问题 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