Giter Club home page Giter Club logo

laravel-gettext's Issues

I don't see that the syntax given in readme actually works in templates?

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.

How do I change languages?

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!

All API throws

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.

messages.po with no messages

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.