Index: trunk/extensions/Wikidata/OmegaWiki/languages.php |
— | — | @@ -90,37 +90,19 @@ |
91 | 91 | /* Use a simpler query if the user's language is English. */ |
92 | 92 | /* getLanguageIdForCode( 'en' ) = 85 */ |
93 | 93 | |
94 | | -// alternative query, slower? |
95 | | -// if ( $lang_code == 'en' || !( $lang_id = getLanguageIdForCode( $lang_code ) ) ) |
96 | | -// return 'SELECT language.language_id AS row_id,language_names.language_name' . |
97 | | -// ' FROM language' . |
98 | | -// ' JOIN language_names ON language.language_id = language_names.language_id' . |
99 | | -// ' WHERE language_names.name_language_id = 85' ; |
100 | | -// /* Fall back on English in cases where a language name is not present in the |
101 | | -// user's preferred language. */ |
102 | | -// else |
103 | | -// return 'SELECT language.language_id AS row_id,COALESCE(ln1.language_name,ln2.language_name) AS language_name' . |
104 | | -// ' FROM language' . |
105 | | -// ' LEFT JOIN language_names AS ln1 ON language.language_id = ln1.language_id AND ln1.name_language_id = ' . $lang_id . |
106 | | -// ' JOIN language_names AS ln2 ON language.language_id = ln2.language_id AND ln2.name_language_id = 85' ; |
107 | | - |
108 | 94 | if ( $lang_code == 'en' || !( $lang_id = getLanguageIdForCode( $lang_code ) ) ) |
109 | | - return 'SELECT language.language_id AS row_id,language_names.language_name' . |
110 | | - ' FROM language' . |
111 | | - ' JOIN language_names ON language.language_id = language_names.language_id' . |
112 | | - ' WHERE language_names.name_language_id = 85' ; |
| 95 | + return 'SELECT language_id AS row_id, language_name' . |
| 96 | + ' FROM language_names' . |
| 97 | + ' WHERE name_language_id = 85' ; |
113 | 98 | /* Fall back on English in cases where a language name is not present in the |
114 | 99 | user's preferred language. */ |
115 | 100 | else |
116 | | - return 'SELECT language.language_id AS row_id, language_names.language_name AS language_name' . |
117 | | - ' FROM language' . |
118 | | - ' JOIN language_names ON language.language_id = language_names.language_id' . |
119 | | - ' WHERE language_names.name_language_id = ' . $lang_id . |
120 | | - ' OR ( language_names.name_language_id = 85 ' . |
121 | | - ' AND language.language_id NOT IN ( SELECT language_id FROM language_names WHERE language_names.name_language_id = ' . $lang_id . |
| 101 | + return 'SELECT language_id AS row_id, language_name' . |
| 102 | + ' FROM language_names' . |
| 103 | + ' WHERE name_language_id = ' . $lang_id . |
| 104 | + ' OR ( name_language_id = 85 ' . |
| 105 | + ' AND language_id NOT IN ( SELECT language_id FROM language_names WHERE name_language_id = ' . $lang_id . |
122 | 106 | ' ) ) ' ; |
123 | | - |
124 | | - |
125 | 107 | } |
126 | 108 | |
127 | 109 | function getLanguageIdForName( $name ) { |