rtranslate.vim


Ⅰ. 插件描述

Easier translations with rails

Ⅱ. 基本信息

创建日期:  2012-06-24
使用用户:  2
Github星:  3
插件作者:  Andrew Radev

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'andrewradev/rtranslate-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'andrewradev/rtranslate-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'andrewradev/rtranslate-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/andrewradev/rtranslate.vim

Ⅳ. 文档说明

Note: This was hacked together in like half an hour or something. It is not ready at all. It will most likely remain unfinished for at least a few weeks more.

A plugin that helps with translating strings in rails. Given a piece of view code like this:

<h1>Hello, World!</h1>

We need to add it to the translation file. To do this, first we change it to this:

<h1><%=t 'Hello, World!' %></h1>

Then, mark the text in visual mode and execute :Rtranslate views.hello heading. This should result in the text being changed to this:

<h1><%=t 'views.hello.heading' %></h1>

And an entry will be added in config/locales/en.yml:

views:
  hello:
    heading: Hello, World!

This will currently only work if the views.hello path already exists and I'm not even sure if it'll handle indentation properly. As noted above, this is very not finished for now.

添加新评论