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

Doesn't work if file is not named after locale #2

Open
Silex opened this issue Nov 2, 2015 · 8 comments
Open

Doesn't work if file is not named after locale #2

Silex opened this issue Nov 2, 2015 · 8 comments
Assignees

Comments

@Silex
Copy link

Silex commented Nov 2, 2015

Hello,

  • i18n-translate en.yml en.po works
  • i18n-translate user.yml user.po doesn't work

Any idea why?

@pejuko
Copy link
Owner

pejuko commented Nov 2, 2015

Can you provide user.yml file?

@Silex
Copy link
Author

Silex commented Nov 2, 2015

Here it is:

---
en:
  user:
    cancel_account: cancel account
    mailer:
      confirmation_instructions:
        confirm_account: Confirm account
        message: Message
        welcome: Welcome
    sign_in: Sign in
    sign_out: Logout
    sign_up: Sign up
    user: User

@pejuko pejuko self-assigned this Nov 3, 2015
@pejuko
Copy link
Owner

pejuko commented Nov 3, 2015

i18n-translators-tools is designed to work with directory structure and locales are determined from the file names, so it expects something like user/en.yml. Unfortunately I don't have much time to improve this tool to accept arbitrary conversions right now. If you provide reasonable patch that will keep compatibility I'm going to accept it.

@Silex
Copy link
Author

Silex commented Nov 3, 2015

Can you elaborate on why it needs the file name at all? I mean, the first key in all of these files is the locale...

@pejuko
Copy link
Owner

pejuko commented Nov 3, 2015

Not all types are having locales information within. e.g java properties files does not have, so I needed to keep the information somewhere. If the locale information is in the file name you can convert properties to yaml successfully.

@Silex
Copy link
Author

Silex commented Nov 3, 2015

Ah, I see.

Is there a way to tell i18n-translate which locale we are talking about?

Something like i18n-translate -l en user.yml user.po would be nice.

@pejuko
Copy link
Owner

pejuko commented Nov 3, 2015

I'm leaving this open, so I'll get back in to this in the future. For now you have to rename the file to en.yml and after conversion rename the po file back to user.po. Sorry for the inconvenience.

@Silex
Copy link
Author

Silex commented Nov 3, 2015

Alright, I'll see if I can find some time to make a PR. Thanks for the infos.

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

No branches or pull requests

2 participants