Coder Social home page Coder Social logo

Comments (8)

stof avatar stof commented on May 27, 2024

use the Twig whitespace control:

{% trans -%}
    Some piece of<br>
    Text
{%- endtrans %}

from twig-extensions.

Anahkiasen avatar Anahkiasen commented on May 27, 2024

Tried with spaceless, had forgotten about the dashes, thanks!

from twig-extensions.

Anahkiasen avatar Anahkiasen commented on May 27, 2024

Hm actually that doesn't seem to work, I still get whitespace in the compiled template which gets in the gettext call. Tried clearing Twig's cache and all, same thing.

            {% trans -%}
                Some piece of<br>
                Text
            {%- endtrans %}
        // line 26
        echo gettext("Some piece of<br>
\t\t\t\tText");

from twig-extensions.

Baachi avatar Baachi commented on May 27, 2024

Use the spaceless tag.

from twig-extensions.

Anahkiasen avatar Anahkiasen commented on May 27, 2024

Doesn't work either, because it compiles as a replace and thus the Twig extractor doesn't get it when parsing the compiled templates. Although I forked the extractor so I guess I could try to make that work.

from twig-extensions.

mjerwin avatar mjerwin commented on May 27, 2024

We also have this issue. We are using the spaceless tag in our parent template, but of course that is not applied when loading individual templates for parsing in Poedit.

from twig-extensions.

PatrickRose avatar PatrickRose commented on May 27, 2024

I've been having this issue - and we've done a workaround by monkey patching the compilation and adding:

$msg = preg_replace("%(\n)?\t+%", ' ', $msg);

I'd submit as a patch but I've not got the time to add the tests that'd be required.

from twig-extensions.

fabpot avatar fabpot commented on May 27, 2024

I'm closing all issues/PRs on the i18n extension as I don't use it and I don't have time to maintain it anymore. This repository will be soon deprecated in favor of the twig/*-extra packages, but i18n wont be transferred. If anyone wants to work on the i18n extension, I would recommend to take the code from here and host it on a new repository.

from twig-extensions.

Related Issues (20)

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.