Skip to content

Instantly share code, notes, and snippets.

@tommarshall
Created July 23, 2013 11:03
Show Gist options
  • Select an option

  • Save tommarshall/6061574 to your computer and use it in GitHub Desktop.

Select an option

Save tommarshall/6061574 to your computer and use it in GitHub Desktop.

Revisions

  1. tommarshall created this gist Jul 23, 2013.
    190 changes: 190 additions & 0 deletions Gettext.tmLanguage
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,190 @@
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>comment</key>
    <string>
    TODO: Command for copy original to untranslated, label as fuzzy, remove fuzzy, next fuzzy etc
    Create meta scope for each entry
    </string>
    <key>fileTypes</key>
    <array>
    <string>po</string>
    <string>potx</string>
    </array>
    <key>keyEquivalent</key>
    <string>^~G</string>
    <key>name</key>
    <string>Gettext</string>
    <key>patterns</key>
    <array>
    <dict>
    <key>begin</key>
    <string>msgid\s+""</string>
    <key>end</key>
    <string>^$</string>
    <key>name</key>
    <string>entity.name.section.header.po</string>
    </dict>
    <dict>
    <key>captures</key>
    <dict>
    <key>1</key>
    <dict>
    <key>name</key>
    <string>constant.character.double-quote.po</string>
    </dict>
    <key>2</key>
    <dict>
    <key>name</key>
    <string>string.quoted.double.po</string>
    </dict>
    <key>3</key>
    <dict>
    <key>name</key>
    <string>constant.character.double-quote.po</string>
    </dict>
    </dict>
    <key>match</key>
    <string>^msgid(?:_plural)?\s+(")(.*)(")\s*$</string>
    <key>name</key>
    <string>keyword.control.msgid.po</string>
    </dict>
    <dict>
    <key>captures</key>
    <dict>
    <key>1</key>
    <dict>
    <key>name</key>
    <string>constant.character.double-quote.po</string>
    </dict>
    <key>2</key>
    <dict>
    <key>name</key>
    <string>string.quoted.double.po</string>
    </dict>
    <key>3</key>
    <dict>
    <key>name</key>
    <string>constant.character.double-quote.po</string>
    </dict>
    </dict>
    <key>match</key>
    <string>^msgstr(?:\[\d?\])?\s+(")(.*)(")\s*$</string>
    <key>name</key>
    <string>keyword.control.msgstr.po</string>
    </dict>
    <dict>
    <key>captures</key>
    <dict>
    <key>1</key>
    <dict>
    <key>name</key>
    <string>constant.character.double-quote.po</string>
    </dict>
    <key>2</key>
    <dict>
    <key>name</key>
    <string>string.quoted.double.po</string>
    </dict>
    <key>3</key>
    <dict>
    <key>name</key>
    <string>constant.character.double-quote.po</string>
    </dict>
    </dict>
    <key>match</key>
    <string>^msgctxt(?:\[\d?\])?\s+(")(.*)(")\s*$</string>
    <key>name</key>
    <string>keyword.control.msgctxt.po</string>
    </dict>
    <dict>
    <key>captures</key>
    <dict>
    <key>1</key>
    <dict>
    <key>name</key>
    <string>constant.character.double-quote.po</string>
    </dict>
    <key>2</key>
    <dict>
    <key>name</key>
    <string>string.quoted.double.po</string>
    </dict>
    <key>3</key>
    <dict>
    <key>name</key>
    <string>constant.character.double-quote.po</string>
    </dict>
    </dict>
    <key>match</key>
    <string>^(")(.+)(")\s*$</string>
    <key>name</key>
    <string>string.quoted.double.po</string>
    </dict>
    <dict>
    <key>match</key>
    <string>^#\s+(.*)\s*$</string>
    <key>name</key>
    <string>comment.line.number-sign.po</string>
    </dict>
    <dict>
    <key>captures</key>
    <dict>
    <key>1</key>
    <dict>
    <key>name</key>
    <string>keyword.other.flag.po</string>
    </dict>
    </dict>
    <key>match</key>
    <string>^#,\s+((?:(?:fuzzy)|(?:no-)?(?:c|objc|sh|lisp|elisp|librep|scheme|smalltalk|java|csharp|awk|object-pascal|ycp|tcl|perl|perl-brace|php|gcc-internal|qt|boost)-format)(?:,\s*(?:(?:fuzzy)|(?:no-)?(?:c|objc|sh|lisp|elisp|librep|scheme|smalltalk|java|csharp|awk|object-pascal|ycp|tcl|perl|perl-brace|php|gcc-internal|qt|boost)-format))*)\s*$</string>
    <key>name</key>
    <string>comment.line.number-sign.flag.po</string>
    </dict>
    <dict>
    <key>match</key>
    <string>^#\.\s+(.*)\s*$</string>
    <key>name</key>
    <string>comment.line.number-sign.extracted.po</string>
    </dict>
    <dict>
    <key>captures</key>
    <dict>
    <key>1</key>
    <dict>
    <key>name</key>
    <string>constant.character.sourceref.po</string>
    </dict>
    <key>3</key>
    <dict>
    <key>name</key>
    <string>constant.numeric.linenumber.po</string>
    </dict>
    </dict>
    <key>match</key>
    <string>^#:\s+((.*))(:([\d;]*))\s*$</string>
    <key>name</key>
    <string>comment.line.number-sign.reference.po</string>
    </dict>
    <dict>
    <key>match</key>
    <string>^#|\s+(msgid|msgctxt)\s+(".*")\s*$</string>
    <key>name</key>
    <string>comment.line.number-sign.previous.po</string>
    </dict>
    <dict>
    <key>comment</key>
    <string>a line that does not begin with # or ". Could improve this regexp</string>
    <key>match</key>
    <string>^[^#"].+$</string>
    <key>name</key>
    <string>invalid.illegal.po</string>
    </dict>
    </array>
    <key>scopeName</key>
    <string>source.po</string>
    <key>uuid</key>
    <string>F07730BD-59BC-41D0-AC3F-4AB2DCB6C54A</string>
    </dict>
    </plist>