Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8563525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:58:46+00:00 2026-06-11T16:58:46+00:00

This problem has been bothering me for a while, but I would like to

  • 0

This problem has been bothering me for a while, but I would like to fix it once and for all.

I am using the twig template engine in my PHP application. I am using the latest version of Poedit (which uses xgettext 0.18.1) to parse my files for translation strings.

I have set up Poedit to work with twig using these instructions.

Everything works well, but the problem is that when I update my Poedit catalogue, I get errors like this:

1:24:45 PM: somefile.twig:5: warning: unterminated string
1:24:45 PM: somefile.twig:10: warning: unterminated string

This is the dialog:

enter image description here

And this is the file in question:

{% extends somevar ? 'one.twig' : 'two.twig' %}

{% block blah %}
Blah blah
{% endblock %}

{% block blah2%}
<div id="some-id" class="some-class">
some content
</div>
{% endblock %}

However, if I click OK in the error dialog, everything seems to be fine and the strings from the twig template are then loaded into the catalogue.

I know there is a gettext-extractor for twig that has been released recently to pick out the translation strings. However, there are some possible issues:

  • I am not using the symfony 2 framework and am not using the intl extension for twig (we have built our own to suit our purposes).

  • We use a different character for our gettext strings {{ t('some string') }}

  • We would prefer not to have to introduce more external dependencies unless we really have too, otherwise someone trying to get the strings would need to set up twig and the gettext extractor.

Is there a flag I can pass to xgettext to solve this problem? The parsing works fine. I just prefer that the error to not be thrown by gettext.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:58:47+00:00Added an answer on June 11, 2026 at 4:58 pm

    So I continued using that workflow for a few days and found the following problem:

    If I have a resource bundle key like so: <a href="#" title="{{ t('somekey') }}">Test</a>, the settings I was using previously would not pick up the key.

    Since I already had a small PHP script in the background to monitor and compile my assets using Assetic, I simply added a few more lines for the twig templates to be compiled into PHP files (http://twig.sensiolabs.org/doc/extensions/i18n.html#extracting-template-strings).

    I then remove the Twig parser from POEdit and now, all the template strings are just parsed from PHP files, which works great!

    While this solution works, I would still like to find a way to get POEdit and gettext to parse twig files natively. However, if anyone is looking for a solution, this one should work quite well in the meantime.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This problem has been plaguing me for a little while, but I've think I've
This problem has been bothering me for awhile. Occasionally I would set up an
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
Alright so this problem has been breaking my brain all day today. The Problem:
UPDATE It looks like this problem has been quietly fixed in iOS 4.3. Up
This Jquery problem has been bugging me for a while now. I developed a
This has been bothering me for a while, and I'm wondering if there's any
This problem has been solved before, but I'm just not getting it with examples
This problem has been bugging me for a while. I have to load a
Hi people this problem has been bothering me for very long. My images in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.