#31319 closed defect (bug) (fixed)
Use first translation iso instead of by key '1'
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | normal | Version: | 4.2 |
Component: | I18N | Keywords: | has-patch |
Focuses: | Cc: |
Description
The list of available translations on options-general.php uses $translation['iso'][1]
which results into a notice when 1 isn't set (which was the case for me). This patch simply gets the first element from the iso array, which 1 appeared to be anyway.
Tested and patch made on trunk. Let me know if you need more information
Attachments (3)
Change History (21)
#3
@
10 years ago
There's a second instance in line 899, seems like it should be updated as well.
Was curious which language doesn't have that key. Looking at the API response, it's Hazaragi (apparently a language pack for it was recently created).
#4
@
10 years ago
Attached new file that also replaces line 899.
The following language was missing the key:
( [language] => haz [version] => 4.1 [updated] => 2015-02-12 01:05:09 [english_name] => Hazaragi [native_name] => هزاره گی [package] => https://downloads.wordpress.org/translation/core/4.1/haz.zip [iso] => Array ( [2] => haz ) [strings] => Array ( [continue] => ادامه ) )
#5
@
10 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 31447:
#7
@
10 years ago
- Keywords has-patch fixed-major added
- Milestone changed from 4.2 to 4.1.1
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for 4.1.1 consideration.
#9
follow-ups:
↓ 10
↓ 14
↓ 18
@
10 years ago
- Milestone changed from 4.1.1 to 4.2
- Resolution set to fixed
- Status changed from reopened to closed
Since it's only a PHP Notice, and doesn't block Language selection nor Installation, I don't think this warrants inclusion in a minor release.
I've already bumped several other PHP Notice-only issues out.
If it makes sense to, we could set the API to return $language['iso'][1] = $language['iso'][1] ? $language['iso'][1] : $language['iso'][2]
instead.
#10
in reply to:
↑ 9
;
follow-up:
↓ 11
@
10 years ago
Replying to dd32:
Since it's only a PHP Notice, and doesn't block Language selection nor Installation
It does for Hazaragi, so would be nice to fix this either way.
Fixing the API to always return a non-empty ISO 639-1 code sounds like an option, but I'm not sure about repercussions for other languages.
#11
in reply to:
↑ 10
;
follow-up:
↓ 12
@
10 years ago
Replying to SergeyBiryukov:
It does for Hazaragi, so would be nice to fix this either way.
Why? The ISO code is only used for the lang attribute. I could install Hazaragi without problems.
We could change the API to return empty values of languages which don't have an ISO 639-1or ISO 639-2 code, but I don't want to print empty values for the lang attribute, so [31447] is the right fix here.
#12
in reply to:
↑ 11
@
10 years ago
- Keywords fixed-major removed
Replying to ocean90:
Why? The ISO code is only used for the lang attribute. I could install Hazaragi without problems.
Ah yes, you're right.
#15
follow-up:
↓ 17
@
10 years ago
for me it blocks the language selection an also prevents the submit button from showing up. so i even can't save the generel settings at all.
#16
@
10 years ago
Fresh local install 4.1.1. Same issue here, like @Mediastuttgart, it's a blocker.
#17
in reply to:
↑ 15
@
10 years ago
Replying to Mediastuttgart:
for me it blocks the language selection an also prevents the submit button from showing up. so i even can't save the generel settings at all.
Which browser are you using? Could not reproduce in Firefox or Chrome. The notice is there in the page source, but it's not visible on the screen, and it doesn't block the submit button.
Perhaps your issue is #30802?
current()
would be preferred toarray_shift()
, see #31259.