localeapp icon indicating copy to clipboard operation
localeapp copied to clipboard

Selective key pull fails

Open pirj opened this issue 4 years ago • 1 comments

We're working in a team, and there can be a significant number of translations unrelated to my changes. So to avoid a time consuming (would be much worse if we had 100 languages, but we only have ~20) git add -p, I try to:

$ localeapp pull users.form.title

and it gives me:

Fetching users.form.title translations:
Success!
Updating backend:
error: Could not find given locale

There are actually three problems with that:

  1. https://github.com/Locale/localeapp/blob/5f35fa3aad1a091d2f18c4b8eb419e3d239710ba/lib/localeapp.rb#L116 is implying that yaml_data supports key format user.form.title, but it doesn't actually:
yaml_data['users.form.title'] # => nil
yaml_data['en']['users']['form']['title'] => 'Title'
  1. It implies that I want to pull the key for a single locale, e.g. en. However, my intention is to pull the key for all of the locales our app supports, so en.users.form.title, fr.users.form.title, bg.users.form.title etc.

  2. It does not accept multiple keys, while it non-ambiguously could:

$ localeapp pull users.form.title users.show.name users.show.surname

Would you accept a pull request to fix those problems?

pirj avatar Jun 04 '20 11:06 pirj

Hi @pirj,

Thank you for your feedback :+1: Your suggestion sounds promising, I would be happy to review a PR for this feature! We are always opened to merge a PRs as long as it includes tests.

Cheers :wave:

thibaultdalban avatar Jun 04 '20 16:06 thibaultdalban