Snippets for symfony i18n for TextMate

Update: Looks like this post is on symfony blog. You can find more snippets on this website.


The symfony framework uses XLIFF for i18n. If you are new to i18n in symfony, this short blog post gives you a very good introduction.

TextMate symfony bundle comes with a snippet called “xliff” that creates a set of XML’ed lines of the source and translated string. The default key equivalent is set to ⌘-I. The snippet for that is:

<trans-unit id="$1">
  <source>${2:$TM_SELECTED_TEXT}</source>
  <target>$0</target>
</trans-unit>

This is a very handy snippet and I use it quite often. But for the XML files to work properly, you need to add the other tags. Here’s the snippet I use:

<?xml version="1.0" ?>
<xliff version="1.0">
  <file original="global" source-langauge="zl_ZL" datatype="plaintext">
    <body>

$0


    </body>
  </file>
</xliff>

Set “Activation” to “Tab Trigger” “xliff” and set “Scope Selector” to “text.xml”.

Reply

The content of this field is kept private and will not be shown publicly.