Opened 10 years ago
Closed 8 years ago
#37539 closed enhancement (fixed)
translate_user_role only working in admin
| Reported by: | keraweb | Owned by: | ocean90 |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.2 |
| Component: | I18N | Version: | 4.0 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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
@
10 years ago
- Keywords needs-patch added
- Milestone Awaiting Review → Future Release
- Type feature request → enhancement
#2
follow-up:
↓ 3
@
10 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
@
10 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
@
10 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
@
8 years ago
- Keywords dev-feedback removed
- Milestone Future Release → 5.2
- Owner set to
- Status new → 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.