clusteramaryllis / laravel-gettext Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://packagist.org/packages/clusteramaryllis/gettext
License: GNU General Public License v2.0
Home Page: https://packagist.org/packages/clusteramaryllis/gettext
License: GNU General Public License v2.0
The readme says to use the following syntax in templates:
{!! __('Translated string') !!}
These strings are not detected when I update the catalogs from sources in Poedit.
A different syntax seems to work for string extraction:
{{ _('Translated string') }}
At the bottom of readme there is a table with gettext function aliases (including '__'), but the default configuration in gettext.php after vendor:publish doesn't seem to configure these as keywords.
Hello!
I'm sorry for probably being stupid, but how do I change the language?
I have set the language to 'sv' in app.php, but it's still in English.
Trying to do a set_locale results in undefined function.
Thank you in advance!
ErrorException in GettextDriver.php line 264: setlocale(): Specified locale name is too long
in GettextDriver.php line 264
at HandleExceptions->handleError('2', 'setlocale(): Specified locale name is too long', '/srv/http/vhosts/[redacted]/website/vendor/clusteramaryllis/gettext/src/Driver/GettextDriver.php', '264', array('category' => '6', 'argsCount' => '2', 'strCategory' => 'LC_ALL', 'preLocales' => array('LC_CTYPE=pl_PL.UTF-8;LC_NUMERIC=pl_PL.UTF-8;LC_TIME=pl_PL.UTF-8;LC_COLLATE=C;LC_MONETARY=pl_PL.UTF-8;LC_MESSAGES=pl_PL.UTF-8;LC_PAPER=pl_PL.UTF-8;LC_NAME=pl_PL.UTF-8;LC_ADDRESS=pl_PL.UTF-8;LC_TELEPHONE=pl_PL.UTF-8;LC_MEASUREMENT=pl_PL.UTF-8;LC_IDENTIFICATION=pl_PL.UTF-8'), 'locales' => array('LC_CTYPE=pl_PL.UTF-8;LC_NUMERIC=pl_PL.UTF-8;LC_TIME=pl_PL.UTF-8;LC_COLLATE=C;LC_MONETARY=pl_PL.UTF-8;LC_MESSAGES=pl_PL.UTF-8;LC_PAPER=pl_PL.UTF-8;LC_NAME=pl_PL.UTF-8;LC_ADDRESS=pl_PL.UTF-8;LC_TELEPHONE=pl_PL.UTF-8;LC_MEASUREMENT=pl_PL.UTF-8;LC_IDENTIFICATION=pl_PL.UTF-8')))
at setlocale('6', array('LC_CTYPE=pl_PL.UTF-8;LC_NUMERIC=pl_PL.UTF-8;LC_TIME=pl_PL.UTF-8;LC_COLLATE=C;LC_MONETARY=pl_PL.UTF-8;LC_MESSAGES=pl_PL.UTF-8;LC_PAPER=pl_PL.UTF-8;LC_NAME=pl_PL.UTF-8;LC_ADDRESS=pl_PL.UTF-8;LC_TELEPHONE=pl_PL.UTF-8;LC_MEASUREMENT=pl_PL.UTF-8;LC_IDENTIFICATION=pl_PL.UTF-8')) in GettextDriver.php line 264
at GettextDriver->setLocale('6', 'LC_CTYPE=pl_PL.UTF-8;LC_NUMERIC=pl_PL.UTF-8;LC_TIME=pl_PL.UTF-8;LC_COLLATE=C;LC_MONETARY=pl_PL.UTF-8;LC_MESSAGES=pl_PL.UTF-8;LC_PAPER=pl_PL.UTF-8;LC_NAME=pl_PL.UTF-8;LC_ADDRESS=pl_PL.UTF-8;LC_TELEPHONE=pl_PL.UTF-8;LC_MEASUREMENT=pl_PL.UTF-8;LC_IDENTIFICATION=pl_PL.UTF-8')
at call_user_func_array(array(object(GettextDriver), 'setLocale'), array('6', 'LC_CTYPE=pl_PL.UTF-8;LC_NUMERIC=pl_PL.UTF-8;LC_TIME=pl_PL.UTF-8;LC_COLLATE=C;LC_MONETARY=pl_PL.UTF-8;LC_MESSAGES=pl_PL.UTF-8;LC_PAPER=pl_PL.UTF-8;LC_NAME=pl_PL.UTF-8;LC_ADDRESS=pl_PL.UTF-8;LC_TELEPHONE=pl_PL.UTF-8;LC_MEASUREMENT=pl_PL.UTF-8;LC_IDENTIFICATION=pl_PL.UTF-8')) in Gettext.php line 47
at Gettext->setLocale('6', 'LC_CTYPE=pl_PL.UTF-8;LC_NUMERIC=pl_PL.UTF-8;LC_TIME=pl_PL.UTF-8;LC_COLLATE=C;LC_MONETARY=pl_PL.UTF-8;LC_MESSAGES=pl_PL.UTF-8;LC_PAPER=pl_PL.UTF-8;LC_NAME=pl_PL.UTF-8;LC_ADDRESS=pl_PL.UTF-8;LC_TELEPHONE=pl_PL.UTF-8;LC_MEASUREMENT=pl_PL.UTF-8;LC_IDENTIFICATION=pl_PL.UTF-8') in Gettext.php line 26
at Gettext->__construct(object(GettextDriver)) in GettextServiceProvider.php line 104
at GettextServiceProvider->Clusteramaryllis\Gettext\{closure}(object(Application), array()) in Container.php line 734
at Container->build(object(Closure), array()) in Container.php line 627
at Container->make('gettext', array()) in Application.php line 674
at Application->make('gettext') in Container.php line 1159
at Container->offsetGet('gettext') in Facade.php line 149
at Facade::resolveFacadeInstance('gettext') in Facade.php line 118
at Facade::getFacadeRoot() in Facade.php line 203
at Facade::__callStatic('bindTextDomain', array('messages', '/srv/http/vhosts/[redacted]/website/resources/locale')) in Front.php line 20
at Gettext::bindTextDomain('messages', '/srv/http/vhosts/[redacted]/website/resources/locale') in Front.php line 20
at Front->index()
This happens during the second invocation of GettextDriver::setLocale() that is executed sometime during whatever is done when trying to call any API through the facade. On the first invocation of the setLocale() method the result of native setlocale() is stored in $this->currentLocale, and on the second invocation it is passed back to setLocale(). The long string you see in the backtrace is what native setlocale() returns the first time. I don't think this is what you expect.
As you can see near the bottom of the stack dump, all this happens during on-demand construction of the Gettext instance as a result of using the facade for the first time. The specific API attempted (bindTextDomain) doesn't even involve setting the locale.
I'm on Laravel 5.1, Windows, and I tested with both version 1.1.1 and the just added 2.0.0 with no luck.
Running php artisan gettext:create, generates all the messages.po files inside resources/locale/[lang]/LC_MESSAGES/messages.po but it only contains the header.
I have blade files under resources/views with {{ _('Welcome to application') }} and also calling _ function for some messages in controllers.
I also tried to manually put a message on messages.po but it doesn't get translated.
Am I missing anything?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.