Opened 3 years ago
Last modified 3 years ago
#54086 new defect (bug)
bloginfo language issue
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Networks and Sites | Keywords: | reporter-feedback needs-patch |
Focuses: | multisite | Cc: |
Description
hi,
the code snippet below only returns the name of the blog well, not the language, it is always the same.
even though the language is changed in the site admin settings.
<?php $sites = get_sites(); foreach ( $sites as $site ) { switch_to_blog( $site->blog_id ); echo get_bloginfo( 'name' ); echo get_bloginfo( 'language' ); restore_current_blog(); }
Change History (5)
#3
in reply to:
↑ 1
;
follow-up:
↓ 4
@
3 years ago
Replying to spacedmonkey:
Hello @kukac7, welcome to track.
language can be tricky to workout. determine_locale and get_locale are complex functions.
If you are looking for the site language, have you tried calling echo get_option( 'WPLANG' ); instead of echo get_bloginfo( 'language' ). This might work better in this context.
hi,
i have tried this now, but my problem is that in the general settings i have saved the language on the selected site, but with the network site settings the WPLANG field is empty on the selected site.
interesting.
and if i write in the WPLANG field, save, but it remains blank again.
#4
in reply to:
↑ 3
@
3 years ago
Replying to kukac7:
Replying to spacedmonkey:
Hello @kukac7, welcome to track.
language can be tricky to workout. determine_locale and get_locale are complex functions.
If you are looking for the site language, have you tried calling echo get_option( 'WPLANG' ); instead of echo get_bloginfo( 'language' ). This might work better in this context.
hi,
i have tried this now, but my problem is that in the general settings i have saved the language on the selected site, but with the network site settings the WPLANG field is empty on the selected site.
interesting.
and if i write in the WPLANG field, save, but it remains blank again.
very strange.
by default hu_HU is the language of the network.
if i set it to en_EN on one site, WPLANG is empty.
however, de_DE, the ru_RU language, works.
Hello @kukac7, welcome to track.
language can be tricky to workout. determine_locale and get_locale are complex functions.
If you are looking for the site language, have you tried calling echo get_option( 'WPLANG' ); instead of echo get_bloginfo( 'language' ). This might work better in this context.