Index: trunk/extensions/WebFonts/resources/ext.webfonts.js |
— | — | @@ -218,16 +218,20 @@ |
219 | 219 | */ |
220 | 220 | loadFontsForLangAttr: function() { |
221 | 221 | var languages = mw.webfonts.config.languages; |
| 222 | + var requested = [mw.config.get( 'wgUserVariant' ), mw.config.get( 'wgContentLanguage' ), mw.config.get( 'wgUserLanguage' )]; |
222 | 223 | // If there are tags with lang attribute, |
223 | 224 | $( 'body' ).find( '*[lang]' ).each( function( index ) { |
224 | | - // .. check the availability of font, add a font-family style if it does not have any |
225 | | - if( languages[this.lang] && ( !this.style.fontFamily || this.style.fontFamily === 'none' ) ) { |
226 | | - fontFamily = languages[this.lang][0]; |
227 | | - mw.webfonts.addFont( fontFamily ); |
228 | | - $(this).css( 'font-family', fontFamily ).addClass( 'webfonts-lang-attr' ); |
| 225 | + // If the lang attribute value is same as one of |
| 226 | + // contentLang,useLang, variant, no need to do this. |
| 227 | + if( $.inArray( this.lang , requested ) === -1 ) { |
| 228 | + // check the availability of font, add a font-family style if it does not have any |
| 229 | + if( languages[this.lang] && ( !this.style.fontFamily || this.style.fontFamily === 'none' ) ) { |
| 230 | + fontFamily = languages[this.lang][0]; |
| 231 | + mw.webfonts.addFont( fontFamily ); |
| 232 | + $(this).css( 'font-family', fontFamily ).addClass( 'webfonts-lang-attr' ); |
| 233 | + } |
229 | 234 | } |
230 | 235 | }); |
231 | | - |
232 | 236 | }, |
233 | 237 | |
234 | 238 | /** |