Title: Twig files support
Last modified: August 22, 2016

---

# Twig files support

 *  [RafaAguilar](https://wordpress.org/support/users/rafaaguilar/)
 * (@rafaaguilar)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/twig-files-support/)
 * Hi,
 * You can add support for .twig templates?
 * Thanks in advance
 * [https://wordpress.org/plugins/loco-translate/](https://wordpress.org/plugins/loco-translate/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Tim W](https://wordpress.org/support/users/timwhitlock/)
 * (@timwhitlock)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/twig-files-support/#post-5642546)
 * Can you point me at an example of WordPress localisation implemented in Twig?
 * I will look into supporting Twig if (1) it seems like a common thing people do,
   and (2) there is a standard (WordPress) way of doing it.
 *  Thread Starter [RafaAguilar](https://wordpress.org/support/users/rafaaguilar/)
 * (@rafaaguilar)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/twig-files-support/#post-5642547)
 * The next php code is a filter for translate a string:
 *  $this->addFilter(“translate”, function ($string, $scope) {
    return __($string,
   $scope); });
 * And this is a twig template:
 * <div class=”title”>{{ notice.post_title| translate( ‘notices’ ) }}</div>
 * Exists another plugin for translate with .mo and .po and another user request
   this feature also.
 * [https://wordpress.org/support/topic/add-twig-template-files-as-support?replies=2](https://wordpress.org/support/topic/add-twig-template-files-as-support?replies=2)
 * Thank you!!
 *  Plugin Author [Tim W](https://wordpress.org/support/users/timwhitlock/)
 * (@timwhitlock)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/twig-files-support/#post-5642548)
 * Thanks for posting the code.
 * My question was more about whether there is an agreed convention for the function
   aliases. So `translate` => `__` seems obvious, but there are numerous other localisation
   function calls to consider too. I obviously can’t support everybody’s personal
   naming conventions, but need to start somewhere.
 * I’d like to do this for the [full Loco system](https://localise.biz/). (The more
   formats the better) So I’ll look into it. If it works out, I’ll look at then 
   implementing it into the WordPress plugin.
 *  [Ionel Roiban](https://wordpress.org/support/users/wpdeveloper/)
 * (@wpdeveloper)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/twig-files-support/#post-5642568)
 * “__string_to_translate” is what Twig supports. All we need is for Twig files 
   to be parsed. thank you.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Twig files support’ is closed to new replies.

 * ![](https://ps.w.org/loco-translate/assets/icon-256x256.png?rev=1000676)
 * [Loco Translate](https://wordpress.org/plugins/loco-translate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/loco-translate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/loco-translate/)
 * [Active Topics](https://wordpress.org/support/plugin/loco-translate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/loco-translate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/loco-translate/reviews/)

## Tags

 * [.mo](https://wordpress.org/support/topic-tag/mo/)
 * [po](https://wordpress.org/support/topic-tag/po/)

 * 4 replies
 * 3 participants
 * Last reply from: [Ionel Roiban](https://wordpress.org/support/users/wpdeveloper/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/twig-files-support/#post-5642568)
 * Status: not a support question