Opened 9 years ago
Closed 6 years ago
#37539 closed enhancement (fixed)
translate_user_role only working in admin
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.2 | Priority: | normal |
Severity: | normal | Version: | 4.0 |
Component: | I18N | Keywords: | has-patch |
Focuses: | Cc: |
Description
The user role translations are only available in the admin.
I'd like to see them available in the front-end aswell.
This is not working:
if ( ! is_admin() ) {
load_textdomain( 'default', WP_LANG_DIR . '/admin-' . get_locale() . '.mo' );
}
Attachments (2)
Change History (10)
#1
follow-up:
↓ 5
@
9 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
- Type changed from feature request to enhancement
#2
follow-up:
↓ 3
@
9 years ago
Not only that.
The default .mo files for the front-end doesn't contain the role translations at all.
Found a workaround:
add_action( 'init', 'load_admin_textdomain_in_front' )
function load_admin_textdomain_in_front() {
if ( ! is_admin() ) {
load_textdomain( 'default', WP_LANG_DIR . '/admin-' . get_locale() . '.mo' );
}
}
#3
in reply to:
↑ 2
;
follow-up:
↓ 4
@
9 years ago
Replying to keraweb:
The default .mo files for the front-end doesn't contain the role translations at all.
That's why we have to move them. :)
#5
in reply to:
↑ 1
@
9 years ago
Replying to ocean90:
To make them available on the front end we have to put the user roles into a /wp-includes file.
Why not simply within the translate_user_role
function?
Seems like the most logical location to me.
EDIT: Nevermind, then this would be executed with every call.. Maybe outside this function?
#7
@
6 years ago
- Keywords dev-feedback removed
- Milestone changed from Future Release to 5.2
- Owner set to ocean90
- Status changed from new to accepted
37539.2.diff moves the strings to /wp-includes/capabilities.php
.
To make them available on the front end we have to put the user roles into a /wp-includes file.