Coder Social home page Coder Social logo

herbgobbler's People

Stargazers

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

Watchers

 avatar  avatar

herbgobbler's Issues

Adds htmlerb to view names

When the tool extracts translations it puts them in keys like this
devise:
confirmations:
newhtmlerb:

Rails can't find them. If I remove the htmlerb part it's fine.

running herbgobbler a second time in the same application crashes

Repro.
run herbgobbler once.
run it again

/usr/local/lib/ruby/gems/2.1.0/gems/herbgobbler-0.3.11/lib/core/rails_translation_store.rb:91:in escape': undefined methodgsub' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/gems/2.1.0/gems/herbgobbler-0.3.11/lib/core/rails_translation_store.rb:74:in block in serialize' from /usr/local/lib/ruby/gems/2.1.0/gems/herbgobbler-0.3.11/lib/core/base_translation_store.rb:14:inblock (2 levels) in each'
from /usr/local/lib/ruby/gems/2.1.0/gems/herbgobbler-0.3.11/lib/core/base_translation_store.rb:12:in each' from /usr/local/lib/ruby/gems/2.1.0/gems/herbgobbler-0.3.11/lib/core/base_translation_store.rb:12:inblock in each'
from /usr/local/lib/ruby/gems/2.1.0/gems/herbgobbler-0.3.11/lib/core/base_translation_store.rb:11:in each' from /usr/local/lib/ruby/gems/2.1.0/gems/herbgobbler-0.3.11/lib/core/base_translation_store.rb:11:ineach'
from /usr/local/lib/ruby/gems/2.1.0/gems/herbgobbler-0.3.11/lib/core/rails_translation_store.rb:55:in serialize' from /usr/local/lib/ruby/gems/2.1.0/gems/herbgobbler-0.3.11/lib/commandline/gobble_all.rb:64:inblock in execute_i18n'
from /usr/local/lib/ruby/gems/2.1.0/gems/herbgobbler-0.3.11/lib/commandline/gobble_all.rb:64:in open' from /usr/local/lib/ruby/gems/2.1.0/gems/herbgobbler-0.3.11/lib/commandline/gobble_all.rb:64:inexecute_i18n'
from /usr/local/lib/ruby/gems/2.1.0/gems/herbgobbler-0.3.11/lib/commandline/gobble_all.rb:17:in execute' from /usr/local/lib/ruby/gems/2.1.0/gems/herbgobbler-0.3.11/bin/gobble:32:in<top (required)>'
from /usr/local/bin/gobble:23:in load' from /usr/local/bin/gobble:23:in

'

Open paranthesis are left behind in the erb file

This is a diff for the respective line. For repro, install the devise gem and generate the devise views( devise/registrations/edit.html.erb)

  • (<%= @minimum_password_length %> characters minimum)
  • (<%= t '.characters', :minimum => (@minimum_password_length) %>

textfinder/textreplacer

Hey, great library! I was working on an equivalent of this for haml, as you can see here:

https://github.com/shaiguitar/haml-i18n-extractor

That lib has got an interactive executable as you can see the demo on the README file. I'm not familiar with the herbgobbler internals, so I was wondering if you have a concept similar to what is here:

https://github.com/shaiguitar/haml-i18n-extractor/blob/master/test/text_finder_test.rb
https://github.com/shaiguitar/haml-i18n-extractor/blob/master/test/text_replacer_test.rb

If you did, I was thinking I could merge those concepts into the existing tool, or create a superset tool that would encompass both libraries, and abstract the templates they are working on, and just be a template-i18n-replacing library of sorts.

Hope that makes sense.

Also, if you do use haml or know anyone who does, I would be curious to know if you have any feedback about the above tool.

Thanks!

Incorrectly extracts &times;

Herbgobbler extract incorrectly the ร— in ร—
It transforms it into t .times.

Ps. Thanks for this. It's very cool

Configuration

It would be great if one could configure how the translation is done. For example, I prefer t('.some_key') instead of the current output t '.some_key'. It would be great if I could chose that.

herbgobbler doesn't move confirm: into the translation file

I have a link_to with a confirm: key added to it. Herbgobbler transfers the text of the link, but not the confirm. It would be great if it would move the confirm to the translation files, as well

Before gobble i18n -a .
-<%= link_to '| Leave course', @course_subscription, method: :delete, remote:true, confirm: "All your progress will be lost, are you sure you want to leave course?" %>

After.
+<%= link_to (t '.leave_course'), @course_subscription, method: :delete, remote:true, confirm: "All your progress will be lost, are you sure you want to leave course?" %>

It would be great if the confirm text would be added as well

automatization with user input

Hey,
nice approach. the automatization is great. i think it would be nice to have some more user input.... if i could enter the translation key t("dashboard.recent_entries") and optional the tranlation for each string found in view files. finding already translated keys in the view would be good (for refactoring purpose).

the full automatization would only work in some cases for me, espacialy if i have to refactor a project or add translation later on.

best, Kalle

Herbgobbler -f doesn't work

The tool doesn't consider -f flag.

gobble i18n -f app/views/home/home.html.erb
***** HerbGobbler Usage *****

Options
tr8n | i18n : Use the normal rails i18n output format or use tr8n output
-a : Process an entire Rails Code Base
-f : Process a single file

Usage: gobble tr8n -a

herbgobbler gets confused in devise/registrations/edit.html.erb

Herbgobbler gets confused on the following line:

Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

This is what it generates

<%= t '.unhappy', :button_to => (button_to (t '.cancel_my_1'), registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete) %>

en.yml:
cancel_my_1: "Cancel my account"
unhappy: "Unhappy? %{button_to}"

In my opinion, this would be simpler like this:

t('.unhappy') <%= button_to t('.cancel_my'), registration_path(resource_name), data: { confirm: t('.are_you_sure')}, method: :delete %>

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.