Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not add new translations #162

Closed
ylecuyer opened this issue Jul 31, 2015 · 15 comments
Closed

Does not add new translations #162

ylecuyer opened this issue Jul 31, 2015 · 15 comments
Labels
Milestone

Comments

@ylecuyer
Copy link

I have the following issue:

[ylecuyer@archlinux test]$ i18n-tasks add-missing -v '■■■■■■■' dummy
Added 0 keys
ø
[ylecuyer@archlinux test]$ i18n-tasks add-missing en es fr
Added 3 keys
+--------+--------------------+--------------------+
| Locale | Key                | Value              |
+--------+--------------------+--------------------+
|   en   | rate_cant_be_empty | Rate cant be empty |
|   es   | rate_cant_be_empty | Rate cant be empty |
|   fr   | rate_cant_be_empty | Rate cant be empty |
+--------+--------------------+--------------------+
[ylecuyer@archlinux test]$ i18n-tasks add-missing -v '■■■■■■■' dummy
Added 1 key
+--------+--------------------+---------+
| Locale | Key                | Value   |
+--------+--------------------+---------+
| dummy  | rate_cant_be_empty | ■■■■■■■ |
+--------+--------------------+---------+

The expected output for the first command is the result of the third output and the third output should be equal to the first.

@glebm
Copy link
Owner

glebm commented Aug 1, 2015

Looks like i18n-tasks does not know about the locales in your project. What does i18n-tasks config say about the locales (locales, base_locale)?

@ylecuyer
Copy link
Author

ylecuyer commented Aug 1, 2015

Here are the values about locales :

internal_locale: en
base_locale: en
locales:
- en
- dummy
- es
- fr

@glebm
Copy link
Owner

glebm commented Aug 1, 2015

The locales seem OK. What does i18n-tasks missing report before the first command?

@ylecuyer
Copy link
Author

ylecuyer commented Aug 1, 2015

There is the output :

[ylecuyer@archlinux test]$ i18n-tasks missing
Missing translations (1) | i18n-tasks v0.8.3
+--------+------+----------------------------------+
| Locale | Key  | Value in other locales or source |
+--------+------+----------------------------------+
|   en   | test | app/views/sites/show.html.erb:3  |
+--------+------+----------------------------------+
[ylecuyer@archlinux test]$ i18n-tasks add-missing -v '■■■■■■■' dummy
Added 0 keys
ø

@ylecuyer
Copy link
Author

ylecuyer commented Aug 1, 2015

And there is another test :

[ylecuyer@archlinux test]$ i18n-tasks add-missing dummy
Added 0 keys
ø
[ylecuyer@archlinux test]$ i18n-tasks add-missing fr
Added 0 keys
ø
[ylecuyer@archlinux test]$ i18n-tasks add-missing en
Added 1 key
+--------+------+-------+
| Locale | Key  | Value |
+--------+------+-------+
|   en   | test | Test  |
+--------+------+-------+
[ylecuyer@archlinux test]$ i18n-tasks missing
Missing translations (3) | i18n-tasks v0.8.3
+--------+------+----------------------------------+
| Locale | Key  | Value in other locales or source |
+--------+------+----------------------------------+
| dummy  | test | en Test                          |
|   es   | test | en Test                          |
|   fr   | test | en Test                          |
+--------+------+----------------------------------+
[ylecuyer@archlinux test]$ i18n-tasks add-missing -v '■■■■■■■' dummy
Added 1 key
+--------+------+---------+
| Locale | Key  | Value   |
+--------+------+---------+
| dummy  | test | ■■■■■■■ |
+--------+------+---------+

@ylecuyer
Copy link
Author

ylecuyer commented Aug 1, 2015

May be related to #134

@glebm
Copy link
Owner

glebm commented Aug 2, 2015

This is how i18n-tasks currently resolves missing keys:

  • Keys missing in source are only considered missing in the base locale.
  • Keys in locale A but not B are considered missing in B.

So when you run i18n-tasks add-missing dummy, the key is missing in en but not in the other locales.
This assumes the base locale is the one the keys are added to first.

@glebm glebm added the bug label Aug 2, 2015
glebm added a commit that referenced this issue Aug 2, 2015
Fixes. #162
Additionally, fixes the `data-remove` task. #140
Possibly fixes. #108
@glebm glebm added this to the v0.8.6 milestone Aug 2, 2015
@glebm
Copy link
Owner

glebm commented Aug 2, 2015

This should be fixed in v0.8.6, please give it a try!

@glebm glebm closed this as completed Aug 2, 2015
@ylecuyer
Copy link
Author

ylecuyer commented Aug 4, 2015

Thank for the quick fix but there is still a problem :

[ylecuyer@archlinux test]$ i18n-tasks add-missing -v '■■■■■■■' dummy
Added 2 keys
+--------+-------------------------------------------+---------+
| Locale | Key                                       | Value   |
+--------+-------------------------------------------+---------+
| dummy  | notify_site_update_commenter_mail_subject | ■■■■■■■ |
| dummy  | notify_site_update_creator_mail_subject   | ■■■■■■■ |
+--------+-------------------------------------------+---------+
[ylecuyer@archlinux test]$ i18n-tasks add-missing en es fr
Added 6 keys
+--------+-------------------------------------------+-------------------------------------------+
| Locale | Key                                       | Value                                     |
+--------+-------------------------------------------+-------------------------------------------+
|   en   | notify_site_update_commenter_mail_subject | ■■■■■■■                                   |
|   en   | notify_site_update_creator_mail_subject   | ■■■■■■■                                   |
|   es   | notify_site_update_commenter_mail_subject | Notify site update commenter mail subject |
|   es   | notify_site_update_creator_mail_subject   | Notify site update creator mail subject   |
|   fr   | notify_site_update_commenter_mail_subject | Notify site update commenter mail subject |
|   fr   | notify_site_update_creator_mail_subject   | Notify site update creator mail subject   |
+--------+-------------------------------------------+-------------------------------------------+

@glebm glebm reopened this Aug 4, 2015
@glebm glebm modified the milestones: v0.8.7, v0.8.6 Aug 7, 2015
glebm added a commit that referenced this issue Aug 7, 2015
glebm added a commit that referenced this issue Aug 7, 2015
@glebm
Copy link
Owner

glebm commented Aug 7, 2015

@ylecuyer Please try the new version (v0.8.7)! Thanks

@glebm glebm closed this as completed Aug 7, 2015
@ylecuyer
Copy link
Author

ylecuyer commented Aug 9, 2015

No it doesn't work either :

[ylecuyer@archlinux test]$ i18n-tasks add-missing -v '■■■■■■■' dummy
Added 2 keys
+--------+--------------------------------------------+---------+
| Locale | Key                                        | Value   |
+--------+--------------------------------------------+---------+
| dummy  | km                                         | ■■■■■■■ |
| dummy  | notify_site_owner_new_comment_mail_subject | ■■■■■■■ |
+--------+--------------------------------------------+---------+
[ylecuyer@archlinux test]$ i18n-tasks add-missing en es fr
Added 10 keys
+--------+--------------------------------------------+---------+
| Locale | Key                                        | Value   |
+--------+--------------------------------------------+---------+
|   en   | km                                         | ■■■■■■■ |
|   en   | notify_site_owner_new_comment_mail_subject | ■■■■■■■ |
|   es   | a_site_you_commented_as_a_new_comment      | ■■■■■■■ |
|   es   | a_site_you_commented_as_been_updated       | ■■■■■■■ |
|   es   | km                                         | ■■■■■■■ |
|   es   | notify_site_owner_new_comment_mail_subject | ■■■■■■■ |
|   fr   | a_site_you_commented_as_a_new_comment      | ■■■■■■■ |
|   fr   | a_site_you_commented_as_been_updated       | ■■■■■■■ |
|   fr   | km                                         | ■■■■■■■ |
|   fr   | notify_site_owner_new_comment_mail_subject | ■■■■■■■ |
+--------+--------------------------------------------+---------+

Thanks

@glebm
Copy link
Owner

glebm commented Aug 9, 2015

@ylecuyer What is the expected output in the above? Looks correct to me

@ylecuyer
Copy link
Author

ylecuyer commented Aug 9, 2015

For me the correct output shoul be :

[ylecuyer@archlinux test]$ i18n-tasks add-missing -v '■■■■■■■' dummy
Added 2 keys
+--------+--------------------------------------------+---------+
| Locale | Key                                        | Value   |
+--------+--------------------------------------------+---------+
| dummy  | km                                         | ■■■■■■■ |
| dummy  | notify_site_owner_new_comment_mail_subject | ■■■■■■■ |
+--------+--------------------------------------------+---------+
[ylecuyer@archlinux test]$ i18n-tasks add-missing en es fr
Added 10 keys
+--------+--------------------------------------------+---------+
| Locale | Key                                        | Value   |
+--------+--------------------------------------------+---------+
|   en   | km                                         | km |
|   en   | notify_site_owner_new_comment_mail_subject | notify site owner new comment mail subject |
|   es   | a_site_you_commented_as_a_new_comment      | a site you commented as a new comment |
|   es   | a_site_you_commented_as_been_updated       | a site you commented as been updated |
|   es   | km                                         | km |
|   es   | notify_site_owner_new_comment_mail_subject | notify site owner new comment mail subject |
|   fr   | a_site_you_commented_as_a_new_comment      | a site you commented as a new comment |
|   fr   | a_site_you_commented_as_been_updated       | a site you commented as been updated |
|   fr   | km                                         | km |
|   fr   | notify_site_owner_new_comment_mail_subject | notify site owner new comment mail subject |
+--------+--------------------------------------------+---------+

The second command doesn't have the -v option thus it should output text.

@glebm
Copy link
Owner

glebm commented Aug 9, 2015

The default interpolation for add-missing will take the value from another locale (which is now ■■■■ in dummy), which makes the most sense for the majority of use cases. To use the humanized key:

$ i18n-tasks add-missing -v '%{human_key}' en es fr

@ylecuyer
Copy link
Author

Ok. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants