-
Notifications
You must be signed in to change notification settings - Fork 130
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
Use plugin_lang_get to display repo settings keys, trans bool values #215
Conversation
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.
Thanks for your contribution.
There are 2 things that I think should be improved:
- If a repo's data contains keys that are not recognized, an error message is displayed (this can happen with old repos created before a change in how the plugin stored its data):
or, if $g_display_errors is set to hide warnings, we get a very narrow line with no data
I would expect a graceful fall-back to the raw string in this case - While having a descriptive label is a lot better than the raw key, I don't like seeing the "helper text" below, as this is intended as a guide for input. I suggest splitting the strings and only display the helper text in repo_update_page.php
Source/pages/repo_manage_page.php
Outdated
<td><?php echo $t_value ?></td> | ||
<?php } ?> |
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.
To make the code easier to read, I would suggest to use a ternary operator here, i.e.
<td><?php echo is_bool( $t_value ) ? trans_bool( $t_value ) : $t_value ?></td>
Rebased, and hopefully adressed all your comments. |
Hello Martin, and thanks for the revised PR.
Actually you missed point 2 in #215 (review), i.e. splitting the language strings between label and help text. Incidentally, that should remove the need for the
That makes perfect sense, I'll prepare a MantisBT PR so it becomes part of core in a future version. In the meanwhile, to keep the code clean I think it would be better to move this function into Source.API.php, and also wrap it around an if function_exists block to facilitate the transition. |
Hello Damien, a) $s_plugin_SourceGithub_master_branch = 'Primary Branches'; b) $s_plugin_SourceGithub_master_branch_label = 'Primary Branches'; c) $s_plugin_SourceGithub_master_branch_label = 'Primary Branches'; As repo_manage_page and repo_update_page use the same keys to lookup the lang strings a) Would require an additional lookup at least in all "$t_vcs->update_repo_form( $t_repo )" variants, for a key(help) which may (intentionally) not exist. Thoughts? |
From a design perspective, I never liked these labels including help text with HTML formatting, so I thought that this would be a good opportunity to get rid of them. As for implementation, I was actually thinking along the lines of your option a) which I think is cleaner than c); b) does not make sense IMO. I must admit that this was just an idea, I did not fully consider or analyze the implications on the code base and development effort. That being said, I'm not overly concerned about the extra plugin_lang_get() calls, as this would be a one time change. Anyway this is diverging from your PR's original scope, so maybe it would be better to track this refactoring separately. |
trans bool values - conditionally add function "plugin_lang_get_defaulted" for the lookup in Source.API.php
One more update to the PR. Made "basename" otional and last param in "plugin_lang_get_defaulted". For now help text are shown too (minor issue) and will be tackled, when issue #228 gets fixed. |
Indeed, much better this way, and closer to lang_get_defaulted()'s signature too. |
|
Instead of just displaying the raw keys, be user friendly and show the lang
strings as repo_update does. For bool values use trans_bool to get a nice
check mark.