Giter VIP home page Giter VIP logo

rails-i18n.tmbundle's Introduction

Rails I18n Textmate bundle

extractd from http://github.com/svenfuchs/rails-i18n

Installation

To install via Git:

mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/martinciu/Rails-I18n.tmbundle.git
osascript -e ‘tell app “TextMate” to reload bundles’

The bundle adds the following commands:

Extract Translation (cmd-shift-e):

  • prompts you for a dot-separated key
  • adds the translation (mapping the dot-separated key to nested yaml keys)
  • replaces the selected string in your source-code with the dot-separated key wrapped into a call to t(your.key), if interpolations are detected within translation, the replacement text will prompt for them.

Look up Translation (cmd-shift-i):

  • Looks up the currently selected key if text is selected
  • If nothing is selected, it will look up all the keys in the currently selected file.

The bundle adds the following tab triggers:

tr:

  • Inserts I18n.translate("") or translate("") based on your context

The following properties are editable:

  • default locale
  • translation file path
  • whether extract inserts the long syntax (I18n.translate) or short syntax (I18n.t)
  • where and if translation changes are logged

Note that Textmate, while active, won’t reload the translations.yml for you if it’s already open. When you give the focus to another application and then go back to Textmate (e.g. with cmd-tab, cmd-tab) it will reload the file. I found it useful to have translations.yml open on a second monitor while extracting translations from my application.

I still have to figure out how to automatically select the next string after this command has run. It works well to just use Textmate’s “Find Next” though:

  • hit cmd-f and give it ("|').*(\1) as a search expression, tell it to use this as a “Regular expression”
  • hit return and it will select the next string
  • use shift-cmd-e to extract that string
  • hit cmd-g to select the next string

rails-i18n.tmbundle's People

Contributors

martinciu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.