-
Notifications
You must be signed in to change notification settings - Fork 180
Refactor Browse string to Choose File #42
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
Conversation
|
The suggestion here is because Browse is being translated with the default Wordpress text domain so by default it should be a translatable string. When I changed language I saw Browse kept untranslated and looked in the Wordpress core translation strings what is available. Maybe should also separate between type=file and type=media/image and have 2 callbacks. |
|
For file uploads, we should have a configurable label. Right now it's hardcoded and the change you made also hardcoded as well. Instead we should pass the text as a parameter and it'll fallback to |
2873f3e to
9a84b80
Compare
|
ok. added option to pass button label and the default is Choose File which is translated according to Wordpress language. |
src/class.settings-api.php
Outdated
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.
Can you please use ternary operator instead of using a big if/else block?
|
did it at first but it was pretty big by itself so didn't think it's needed as it didn't add readability. but ok. |
|
its pretty big I think if-else is more readable for this case. do you still want it like this ? |
|
Checking only |
|
i'll check if it doesn't give warning in debug |
|
only isset( $args['options']['button_label']) works good. i'll update the commit. thanks |
9a84b80 to
6557b84
Compare
|
updated |
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.
It should be like this:
$label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File' );
Don't need to use $label on the ternary operator.
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.
oh damn. didn't notice it.
Browse is not part of the Wordpress translatation file so it doesn't get translated. Choose File is and will be translated according to the langauge Wordpress is set. Also add option to pass button label. Signed-off-by: Roi Dayan <[email protected]>
6557b84 to
3bb2e13
Compare
File "Browse" string changed to "Choose File"
Browse is not part of the Wordpress translatation file so it doesn't get
translated. Choose File is and will be translated according to the
langauge Wordpress is set.
Signed-off-by: Roi Dayan [email protected]