Quick i18n Tip for Sublime Text Users

Quick i18n Tip for Sublime Text Users

Do you hate wrapping your content with i18n tags? Yeah me too, however your editor might do this much easier for you. Here’s a quick tip on how you can create a shortcut to add e.g. a Django trans template tag around a string in Sublime Text:

1. Open your keymap preferences: Sublime Text → Preferences → Key Bindings (User)

2. Add the following snippet there:

{ 
 "keys" : ["ctrl+shift+g"], 
 "command" : "insert_snippet",
 "args": {
 "contents": "{% trans \"${0:$SELECTION}\" %}"
 }
}

Now when you select the text and hit ctrl+shift+g, it wraps the text with Django’s i18n template tag like this:

{% trans "Continue" %}

If you have any other  tips how to do i18n easily, let us know in the comments below.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s