Index: trunk/extensions/Wikidata/OmegaWiki/languages.php |
— | — | @@ -100,10 +100,10 @@ |
101 | 101 | /* Fall back on English in cases where a language name is not present in the |
102 | 102 | user's preferred language. */ |
103 | 103 | else |
104 | | - return 'SELECT language_id AS row_id, language_name' . |
105 | | - ' FROM language_names' . |
106 | | - ' WHERE name_language_id = ' . $lang_id . |
107 | | - ' OR ( name_language_id = 85 ' . |
108 | | - ' AND language_id NOT IN ( SELECT language_id FROM language_names WHERE name_language_id = ' . $lang_id . |
109 | | - ' ) ) ' ; |
| 104 | + return 'SELECT language.language_id AS row_id, COALESCE(ln1.language_name,ln2.language_name) AS language_name' . |
| 105 | + ' FROM language' . |
| 106 | + ' LEFT JOIN language_names AS ln1 ON language.language_id = ln1.language_id' . |
| 107 | + ' AND ln1.name_language_id = ' . $lang_id . |
| 108 | + ' JOIN language_names AS ln2 ON language.language_id = ln2.language_id AND ln2.name_language_id = 85 ' ; |
| 109 | + |
110 | 110 | } |