All Projects → airblade → vim-localorie

airblade / vim-localorie

Licence: MIT License
A Vim plugin for easy look-up of translations for Rails i18n YAML keys.

Programming Languages

Vim Script
2826 projects
Haml
164 projects
shell
77523 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to vim-localorie

gulp-yaml
A Gulp plugin to convert YAML to JSON
Stars: ✭ 24 (-11.11%)
Mutual labels:  yaml, yml
Yq
Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
Stars: ✭ 1,688 (+6151.85%)
Mutual labels:  yaml, yml
Carvel Ytt
YAML templating tool that works on YAML structure instead of text
Stars: ✭ 816 (+2922.22%)
Mutual labels:  yaml, yml
Yaml Expander
Expands internal property references in a yaml file.
Stars: ✭ 137 (+407.41%)
Mutual labels:  yaml, yml
exenv
Exenv makes loading environment variables from external sources easy.
Stars: ✭ 35 (+29.63%)
Mutual labels:  yaml, yml
pollly
The simplest editor to translate apps & sites for YML files. Fast and Simple. Try now!
Stars: ✭ 32 (+18.52%)
Mutual labels:  yaml, yml
Strictyaml
Type-safe YAML parser and validator.
Stars: ✭ 836 (+2996.3%)
Mutual labels:  yaml, yml
I18n Manager
Translation management app
Stars: ✭ 373 (+1281.48%)
Mutual labels:  i18n, yaml
ad localize
ADLocalize is a simple way to manage your localization files. Supported wording sources : CSVs and Google Sheets. Localization file generation available for iOS, Android, JSON (i18next), YAML and Java properties
Stars: ✭ 22 (-18.52%)
Mutual labels:  i18n, yaml
tr4n5l4te
Use Google Translate without an API key.
Stars: ✭ 32 (+18.52%)
Mutual labels:  i18n, yaml
Simple-YAML
A Java API that provides an easy-to-use way to store data using the YAML format.
Stars: ✭ 68 (+151.85%)
Mutual labels:  yaml, yml
fluidpatcher
A performance-oriented patch interface for FluidSynth
Stars: ✭ 41 (+51.85%)
Mutual labels:  yaml
yorm
Automatic object-YAML mapping for Python.
Stars: ✭ 23 (-14.81%)
Mutual labels:  yaml
home assistant config
HomeAssistant.io Configuration Files
Stars: ✭ 110 (+307.41%)
Mutual labels:  yaml
YmlGenerator
YML (Yandex Market Language) file generator
Stars: ✭ 96 (+255.56%)
Mutual labels:  yml
camunda-modeler-i18n-plugin
This plugin allows you to translate the UI of the Camunda Modeler. It contains ready-to-use translations for German, English, and Portuguese and can be easily extended or customized.
Stars: ✭ 14 (-48.15%)
Mutual labels:  i18n
i18n
IPFS Translation Project
Stars: ✭ 14 (-48.15%)
Mutual labels:  i18n
StackMob-3
A plugin designed for bukkit servers, aiming to reduce the lag that both the server and players experience.
Stars: ✭ 23 (-14.81%)
Mutual labels:  yaml
ide-yaml
Atom-IDE support for YAML language
Stars: ✭ 16 (-40.74%)
Mutual labels:  yaml
i18next-scanner-typescript
Typescript transform for i18next-scanner
Stars: ✭ 21 (-22.22%)
Mutual labels:  i18n

vim-localorie

Localorie is a Vim plugin which makes working with Rails i18n locale files a little easier.

Look up translations

With your cursor on an i18n key in a Rails view or controller, call localorie#translate() to populate the quickfix or location list with all the translations of that key.

If there is only one key in a line, your cursor doesn't need to be on the key to look up its translations - it can be anywhere in the line.

For example, with your cursor somewhere on .title:

# app/views/projects/index.html.erb
<h1><%= t '.title' %></h1>

– calling localorie#translate() will show the translations for projects.index.title.

Supported

  • Fully-qualified lookup in views
  • Lazy lookup in views
  • Fully-qualified lookup in controllers
  • Lazy lookup in controllers
  • Model.model_name.human
  • Model.human_attribute_name

Unsupported (so far)

  • :scope and :default options
  • Localisation keys.
  • Ruby locale files

It would also be nice, in a locale file, to look up locations where a key is used.

Expand YAML key

In a locale file, :echo localorie#expand_key() to echo the fully qualified key of the current line. This is handy when you are in the depths of a locale file and have lost track of the current line's scope.

For example, with your cursor anywhere on the last line:

en:
  foo:
    bar:
      baz: hello

– calling localorie#expand_key() will echo en.foo.bar.baz.

Mappings

I recommend mapping the functions in your vimrc. For example:

nnoremap <silent> <leader>lt :call localorie#translate()<CR>
nnoremap <silent> <leader>le :echo localorie#expand_key()<CR>

Autocommands

Add this autocommand to your vimrc to always see the fully qualified key of the current line:

autocmd CursorMoved *.yml echo localorie#expand_key()

Configuration

By default vim-localorie uses the quickfix list but doesn't switch to the quickfix window. To use the location list and/or switch to the new window, put this in your vimrc:

let g:localorie = {
    \ 'quickfix':  0,
    \ 'switch':    1
    \ }

Installation

Install like any other vim plugin.

Pathogen
cd ~/.vim/bundle
git clone git://github.com/airblade/vim-localorie.git
Voom

Edit your plugin manifest (voom edit) and add:

airblade/vim-localorie
VimPlug

Place this in your .vimrc:

Plug 'airblade/vim-localorie'

Then run the following in Vim:

:source %
:PlugInstall
NeoBundle

Place this in your .vimrc:

NeoBundle 'airblade/vim-localorie'

Then run the following in Vim:

:source %
:NeoBundleInstall
No plugin manager

Copy vim-localorie's subdirectories into your vim configuration directory:

cd /tmp && git clone git://github.com/airblade/vim-localorie.git
cp -r vim-localorie/* ~/.vim/

See :help add-global-plugin.

Intellectual Property

Copyright 2016-2020 Andrew Stewart. Released under the MIT licence.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].