-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
Locale:* bakery command #992
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #992 +/- ##
=============================================
- Coverage 66.82% 66.36% -0.46%
- Complexity 2080 2098 +18
=============================================
Files 160 162 +2
Lines 6791 6838 +47
=============================================
Hits 4538 4538
- Misses 2253 2300 +47
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## develop #992 +/- ##
=============================================
+ Coverage 65.44% 65.85% +0.41%
- Complexity 2007 2046 +39
=============================================
Files 164 172 +8
Lines 6977 7096 +119
=============================================
+ Hits 4566 4673 +107
- Misses 2411 2423 +12
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class name is broken :
https://github.styleci.io/analyses/X0Lyvx?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link
This could also be optimized by having one class extend the other so the common methods can be reused. There's probably more optimization we could add in userfrosting/i18n
to load all keys.
Related #671 |
Also, quick note about that code vs testing. You have a (And yes, I know. |
Try to separate out LocaleMissingKeysCommand
I will need some help on how to do this in a different way. Basically this entire command revolves around a whole lot of arrays... |
Locale updates
commit 3ecf85c Author: Amos Folz <amosfolz@gmail.com> Date: Wed Jun 12 03:16:44 2019 +0000 Looked over all commands. Finalize fix-keys commit 286af71 Author: Amos Folz <33728190+amosfolz@users.noreply.github.com> Date: Tue Jun 11 22:51:57 2019 +0000 Finished fix-keys command commit a910dda Author: Amos Folz <amosfolz@gmail.com> Date: Tue Jun 11 03:28:04 2019 +0000 updates commit 7b60426 Author: Amos Folz <amosfolz@gmail.com> Date: Sun Jun 9 19:32:07 2019 +0000 Update LocaleFixKeysCommand.php commit 0dcf2cc Author: Amos Folz <33728190+amosfolz@users.noreply.github.com> Date: Sun Jun 9 14:18:55 2019 +0000 Update LocaleFixKeysCommand.php commit 1446075 Author: Amos Folz <amosfolz@gmail.com> Date: Sun Jun 9 12:50:17 2019 +0000 Updates
I've made some changes in 8e13cc7. Most changes are style related or adding the PHP 7 type hint for method arguments and return values. I've also optimized the code to make use of return value where possible instead of class properties. Also FYI, class properties where marked as static (eg. In the bigger changes:
Let me know if some of my changes doesn't give the right result, or if you don't understand some of them (might be my personal coding preference). Before merging this in, I'll try to add some tests for those three commands. |
(Work in progress - Might break other subcommands)
I've been thinking about this command since my last commit and I think the whole logic of comparing the files is flawed. The commands you created compares the content of I could also create false positive if the core translation has a key that contains an array ( I think it would be best if the translator would have a feature to return a list of all registered keys. Since 4.4 Milestone focus on translation improvement, I'll push this feature to 4.4. At the same time, improvements to the |
I think this entire feature has had a lot of creep outside what I was really trying to accomplish. As per @alexweissman original post in #671 , this was primarily meant to be a tool for helping to keep the built-in translation files up-to-date.
This is true but I'm not sure it's necessarily a flaw. I think when you write code there are assumptions that have to be made. In this situation the assumption is that a standardized, logical naming schema will be used for translation files. It seems it would get extremely complicated to write code that will update/create the translation files without these simple file naming conventions in place.
I'm fine with this but I still think #1006 needs to be considered for |
I think this could pretty easily be done by adding a method or two to the
$translator will have an array of all We could just add a method to return I actually looked back at my notes and this was my original approach for comparison between two different locales, but ended up changing it because because I couldn't see a way to find what files had what keys defined. |
That would probably work great with #868, so you can get a list of keys directly :
|
@amosfolz I've reworked your command into a single Regarding the What I propose, is we add in future version an |
Adds three Bakery commands:
locale:missing-keys
check for missing localekeys
locale:missing-values
check for empty/duplicate localevalues
.locale:fix-keys
Fix locale keys by adding any missing key:values from another locale. I.e. add all key:values that exist inen_US
locale files (but not ines_ES
files) intoes_ES
locale files.locale:fix-keys
can also be used to create the folder structure and all locale files for a brand new locale.