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

How to exclude files from search path? #41

Open
fhg-isi opened this issue Apr 17, 2024 · 1 comment
Open

How to exclude files from search path? #41

fhg-isi opened this issue Apr 17, 2024 · 1 comment

Comments

@fhg-isi
Copy link

fhg-isi commented Apr 17, 2024

I use

i18n.set('filename_format', 'translations.{format}')

to load translations.yml and that works fine.

However, I would like to exclude synonyms.yml from the load path because I use that file for a different purpose.

=> How to do so?

I tried to use negative look ahead regular expression

'^(?!synonyms)translations.{format}'

but that did not work.

@solaluset
Copy link

solaluset commented May 14, 2024

Hello

I have tried settings you've mentioned and it indeed doesn't ignore synonyms.yml, which is strange.
I don't know exactly what causes this, but looks like my fork has this fixed, you can try it out:
https://github.com/solaluset/i18nice

EDIT: figured it out

if not namespace and '{namespace}' not in config.get('filename_format'):
for directory in config.get('load_path'):
load_directory(directory, locale)

Looks like this causes keys without namespace to load translations from unrelated files.

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