# sublime-gettext [Sublime Text][st] support for [`gettext`][gt]'s [Portable Object][po] (`.po`) translation files. ![Screenshot demonstrating some features listed below](Demo/sample.png) ## Features - Scopes for colors follow Sublime Text conventions - Syntax highlighting for documentation key-values + Mini-language for `Plural-Formats` - Goto Symbol for `msgid` contents + Even for multiline strings. See [Known Issues][] below. - Fold markers from `msgid` through the end of the block - Flag-dependent placeholder formats for + Programming languages that use `printf` formatting + Programming languages with `{`/`}` brace placeholders + Shell's `$` dollar variables + Whatever you decide to add ## Installation ### Package Control 1. Make sure you already have [Package Control][pc] installed. 2. Choose **Install Package** from the Command Palette (Super+Shift+P). 3. Type **Gettext** and press Enter. With [auto_upgrade][] enabled, Package Control will keep all installed packages up-to-date! ### Using Git 1. Change to your Sublime Text `Packages` directory. 2. Clone this repository. ### Manual installation 1. Download the latest ZIP file (*./archive/master.zip*). 2. Unzip the archive to your Sublime Text `Packages` directory. ## Usage ### Build Use Ctrl+B to invoke a simple `.mo` build system for the currently opened `.po` file. (Cmd+B on Mac) ### Source reference lookup If your cursor is on a source reference in a `#:` comment, F12 will prefill it in the GoTo overlay. ### Snippets | Type | Trigger | Description | |-------|---------|-----------------------------| | Block | `msg` | Simple message | | Block | `msgc` | Simple message in a context | | Block | `msgp` | Plural message | | Block | `msgcp` | Plural message in a context | | Line | `hdr` | Header key-value pair | | Line | `ctx` | Message context | | Line | `id` | Message ID | | Line | `idp` | Plural message ID | | Line | `str` | Message string | | Line | `strp` | Plural message string | ## Known issues - When the `msgid` contents are long, Goto Symbol may not find phrases in the middle. - Placeholders in string content are shared between language families. The formats may not be perfect. - The source reference lookup is a bit naive. ## Credits - Snippets: [language-gettext](https://github.com/ArnaudRinquin/atom-language-gettext) [st]: https://www.sublimetext.com [gt]: https://www.gnu.org/software/gettext/ [po]: https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html [known issues]: #known-issues [pc]: https://packagecontrol.io [auto_upgrade]: http://wbond.net/sublime_packages/package_control/settings/