-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat: Command lang:find
behavior with parameters
#8899
Comments
I know this is a bit late, but isn't it a bug that this command can't find |
Initially, I did not plan this. There are many options for "gluing" the function |
Code like But code like |
I personally write this code. $groups = [
self::USER => lang('UserGroup.role.' . self::USER),
self::ADMIN => lang('UserGroup.role.' . self::ADMIN),
]; Your second example is also not absolutely correct. Most likely I still haven't found a good solution to the problem. |
Yes, How about this? --- a/system/Commands/Translation/LocalizationFinder.php
+++ b/system/Commands/Translation/LocalizationFinder.php
@@ -192,7 +192,7 @@ class LocalizationFinder extends BaseCommand
}
$fileContent = file_get_contents($file->getRealPath());
- preg_match_all('/lang\(\'([._a-z0-9\-]+)\'\)/ui', $fileContent, $matches);
+ preg_match_all('/lang\(\'([._a-z0-9\-]+)\'/ui', $fileContent, $matches);
if ($matches[1] === []) {
return compact('foundLanguageKeys', 'badLanguageKeys'); If you want a perfect solution, I think the following is better:
|
Another feature request. |
Yes, this case is stated in the first message. |
Doesn't work with Cyrillic |
@kenjis wrote:
We discussed the situation when CI4 is installed from the archive. How do I use |
I think if you really use PHP-Parser, you should create a Composer package for this command. CI4 still supports Zip installation, that is no Composer at all. |
It's a good option. But it will be an unofficial package. I won't be able to support on github. |
I have created a repository with improvements. If you are interested, check it out, I will release it as a package +------------------+---------------------------------------------------------------------+
| File | Key |
+------------------+---------------------------------------------------------------------+
| Translation-Four | Translation-Four.dashed.key-with-dash |
| TranslationFive | TranslationFive.action...{0} {1} {2} {filter} {page} {search} |
| TranslationFive | TranslationFive.users.action...{0} {1} {2} {filter} {page} {search} |
| TranslationFive | TranslationFive.users.post...{0} {?} {page} |
| TranslationThree | TranslationThree.alerts.CANCELED |
| TranslationThree | TranslationThree.alerts.DELETED |
| Статья | Статья.список.действие...{0} {?} {page} |
+------------------+---------------------------------------------------------------------+
|
I think it is possible to display a warning after searching for translations. |
Now, when scanning the application files, only "clean" translation keys will be added. For example,
lang('File.key')
but notlang('File.key', [$val])
lang('File.key', [$val], 'de')
It would be good if such options could be processed. I'm not sure about the final result yet, I'll leave this task as a reminder.
The text was updated successfully, but these errors were encountered: