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

Sync is ignoring anything outside views #21

Closed
vpratfr opened this issue Apr 9, 2016 · 10 comments
Closed

Sync is ignoring anything outside views #21

vpratfr opened this issue Apr 9, 2016 · 10 comments

Comments

@vpratfr
Copy link

vpratfr commented Apr 9, 2016

There are lots of places where we have messages: controllers, validation, events, etc. All of them are not taken into account, just the views.

This would be fair to incorporate those classes into the sync process.

@ahmedash95
Copy link
Contributor

@themsaid i think you should close this issue now :D.

@vpratfr
Copy link
Author

vpratfr commented Apr 13, 2016

@ahmedash95 Question :

I have translations for enums. Here is some code :

Enum declaration in config/enums.php

return [ 'gender' => [ 'MALE', 'FEMALE', ] ];

Translations in resources/lang/en/enums.php

return [ 'gender' => [ 
    'MALE' => 'Man', 
    'FEMALE' => 'Woman',
] ];

Views can use it from a model for example:

{{ trans('enums.gender.' . $person->gender); }}

What happens in that case when you sync translations? What is the content of enums.php after the sync process?

@ahmedash95
Copy link
Contributor

@vpratfr config/enums.php out of sync scope becase it just an array doesn't use any lang methods! . or I misunderstand ?

@themsaid
Copy link
Owner

{{ trans('enums.gender.' . $person->gender); }}

The above method call will be ignored by the sync command as it contains a dynamic key, only specific key calls are considered. If you have an idea on how to support this type of calls I'll be glad to consider it.

@vpratfr
Copy link
Author

vpratfr commented Apr 13, 2016

There is no real way to support it. However, good to know it is ignored, I think that is the best way to handle it.

How about the existing translation messages in resources/lang/en/enums.php? Will they get erased?

It would be handy (and maybe safe) to be able to specify a list of files to ignore in the lang folders when sync-ing.

@vpratfr
Copy link
Author

vpratfr commented Apr 13, 2016

Actually I think we are mixing two different things:

  • Process of finding/removing translation keys from the code (views, classes) and updating the translation files with that (potentially only touching the default language files, not translations).
  • Process of simply synchronizing translation files accross languages (I have a set of files for default language en (could be another default lang) which is supposed to be complete, and now I want to add/remove missing keys from other language files)

Both of them are doing something different. And I don't really know what your package does. Maybe it would be a good idea to have a command for each?

@themsaid
Copy link
Owner

Nope, it won't get erased, it'll stay untouched.

Regarding ignoring files, why would you want to ignore a file? I don't mind having an option --ignore=enums,users,auth but curious about the use cases.

Regarding your other opened issue, is it still not working? Did you succeed figuring out what was wrong?

@vpratfr
Copy link
Author

vpratfr commented Apr 13, 2016

Ignoring a file is in case a translation is not in code anymore and you remove them from language files.

If you don't do any removal of unused translation keys, then ignoring is not really necessary.

@themsaid
Copy link
Owner

I'm not sure I quite understand the use case, do you mean if you remove the trans() calls for specific keys from code and you want to keep the language file although it's useless?

@themsaid
Copy link
Owner

v1.2.2 now looks inside the app directory in addition to the views directory.

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

No branches or pull requests

3 participants