Sublime snippets to assist with replacing text with i18n symbols and methods. ruby-i18n is for inline ruby, ruby-erb-i18n is the same except with erb syntax, and dt-rails is for turning something like <%= show(@foo, :bar) %> into <dt><%= :bar %></dt><dd><%= @foo.bar %></dd>
<snippet> | |
<content><![CDATA[ | |
<dt><%= ${1:${SELECTION/.*?(:\w*).*/$1/}} %></dt> | |
<dd><%= ${2:${SELECTION/.*?(@\w*).*?:(\w*).*/$1.$2/}} %></dd> | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>dt-</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>text.html.ruby</scope> | |
</snippet> |
<snippet> | |
<content><![CDATA[<%= I18n.t("${1:${TM_FILEPATH/.*?(\w*)\/(\w*)\/(\w*)\..*/$1\.$2\.$3/}.${3:${SELECTION/.*?([A-Za-z_]*).*?/\L$LAST_SUBMATCH_RESULT/g}}}", :default => "${2:${SELECTION/[\"\']?([^\"\']*)[\"\']?/$+/}}") %>]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>=t</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>text.html.ruby</scope> | |
</snippet> |
<snippet> | |
<content><![CDATA[I18n.t("${1:${TM_FILEPATH/.*?(\w*)\/(\w*)\/(\w*)\..*/$1\.$2\.$3/}.${3:${SELECTION/.*?([A-Za-z_]*).*?/\L$LAST_SUBMATCH_RESULT/g}}}", :default => "${2:${SELECTION/[\"\']?([^\"\']*)[\"\']?/$+/}}")]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>t-</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>text.html.ruby</scope> | |
</snippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment