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

Preventing defaults.en.yml from being split up? #177

Closed
connorshea opened this issue Nov 4, 2015 · 2 comments
Closed

Preventing defaults.en.yml from being split up? #177

connorshea opened this issue Nov 4, 2015 · 2 comments
Labels

Comments

@connorshea
Copy link

I'm unsure exactly how to accomplish what I'm attempting to do here. Essentially, I have a file structure like this:

├── en
│   ├── activerecord.en.yml
│   ├── collections.en.yml
│   ├── defaults.en.yml
│   ├── devise.en.yml
│   ├── devise_custom.en.yml
│   ├── frontpage.en.yml
│   ├── generic.en.yml
│   ├── images.en.yml
│   ├── layouts.en.yml
│   └── users.en.yml
└── fr
    ├── activerecord.fr.yml
    ├── collections.fr.yml
    ├── defaults.fr.yml
    ├── devise.fr.yml
    ├── devise_custom.fr.yml
    ├── frontpage.fr.yml
    ├── generic.fr.yml
    ├── images.fr.yml
    ├── layouts.fr.yml
    └── users.fr.yml

My i18n-tasks.yml config includes this:

data:
  router: pattern_router
  read:
    - 'config/locales/%{locale}/*.yml'
  write:
    - ['{:}.*', 'config/locales/%{locale}/\1.%{locale}.yml']

And this works for everything except defaults.en.yml/defaults.fr.yml, because it has a structure like this, with multiple top-level items in a single file. When running normalize, I get time.en.yml, date.en.yml, etc. Is there any way for me to prevent the strings in defaults.%{locale}.yml from being split up into different files while separating everything else?

Thank you for the awesome gem, it's been super useful for me!

@glebm glebm added the question label Nov 4, 2015
@glebm
Copy link
Owner

glebm commented Nov 4, 2015

data.write is matched top to bottom, try:

  write:
    - ['{time,date}.*', 'config/locales/%{locale}/defaults.%{locale}.yml']
    - ['{:}.*', 'config/locales/%{locale}/\1.%{locale}.yml']

@connorshea
Copy link
Author

That fixed it, thank you so much!

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