-
Notifications
You must be signed in to change notification settings - Fork 16
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
Feature request: Option to ignore certain keys? #33
Comments
Hi! I like your suggestion of adding config items for exclusions, I think we can also use this for the excluded dir option for the command. I will take a look at this tomorrow! |
Can you see if this pr would work for you: |
Hi! This Friday and Monday is a Holiday in my country. I'll be checking in our project's repo this Tuesday. Thank you!! 🚀🚀🚀😁😁 |
@jhm-ciberman can you let me know? |
@LarsWiegers Hello, sorry for the long delay. I had a super bussy week and I forgot. I tested in our repo and I found two problems: Problem 1 // lang/es/my-test.php
return [
'nested' => [
'foo' => 'bar',
],
'foo' => 'zup',
] $ sail art translations:check
Missing the translation with key: en.foo
Missing the translation with key: de.foo
Missing the translation with key: en.foo
Missing the translation with key: de.foo It should show Problem 2: The new // lang/es/my-test.php
return [
'foo' => 'zup',
] // config/laravel-translations-checker.php
return [
'excluded_keys' => [
'my-test.foo',
//'my-test.nested.foo', // I tested for nested and deeply nested and it doesn't work neither.ç
//'foo' // It doesn't work neither with only the leaf key name.
],
]; $ sail art translations:check
Missing the translation with key: en.foo
Missing the translation with key: de.foo |
I pushed a new version can you check if it works now for you? |
@jhm-ciberman please check again :) |
Closing as nothing heard back from @jhm-ciberman |
Sorry. I no longer work for the company in which I was using this package. And I think my coworker removed this package from the dependencies (nothing personal, they used another entirely different system for translations) |
@jhm-ciberman No worries, thanks for letting me know :) |
The problem
Example case 1
Certain translation keys should only be present in certain languages and not others.
For example, in the built-in
validation.php
file, Laravel provides avalidation.custom
array that can be used to add custom validation messaages for specific rules to make the text more precise:These kind of customizations only make sense to be defined per language, because in certain languages those lines are fine as they are without needing to customize them further.
Currently this makes a lot of validation files to fail, even they are right:
Example case 2
Another scenario is the following: In our application we have to generate dynamic messages like "The shop will be open until tomorrow ar 8:00 AM" or "The shop is closed until 5:30 PM". We use a complex algorithm that involves
Carbon::calendar
and translation strings and sometimes the resulting translations aren't perfect. That's why we define a custom'replacements'
array like the following:lang/en/opening-hours.php
lang/es/opening-hours.php
Proposed solution
It would be pretty nice if we could somehow ignore those fields. For example having support for a simple configuration file like:
config/translations-checker.php
The text was updated successfully, but these errors were encountered: