From 814b513aa5d86a38e7b6db220d36fca253bdabfe Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Fri, 6 Nov 2009 16:53:07 +0100 Subject: [PATCH] Fix a few bugs I added in previous revision --- scripts/update_translations.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/update_translations.php b/scripts/update_translations.php index 88780898d5..88b85dc123 100755 --- a/scripts/update_translations.php +++ b/scripts/update_translations.php @@ -39,7 +39,7 @@ set_time_limit(60); $languages = get_all_languages(); /* Update the languages */ -// Language code conversion for translatewiki.net +// Language code conversion for translatewiki.net (these are MediaWiki codes) $codeMap = array( 'nb' => 'no', 'pt_BR' => 'pt-br', @@ -51,17 +51,19 @@ foreach ($languages as $language) { $code = $language['lang']; // Skip export of source language - if( $language == 'en' ) { + // and duplicates + if( $code == 'en' || $code = 'no' ) { continue; } // Convert code if needed if( isset( $codeMap[$code] ) ) { - $code = $codeMap[$code]; + $twnCode = $codeMap[$code]; + } else { + $twnCode = str_replace('_', '-', strtolower($code)); // pt_BR -> pt-br } // Fetch updates from translatewiki.net... - $twcode = str_replace('_', '-', strtolower($code)); // pt_BR -> pt-br $file_url = 'http://translatewiki.net/w/i.php?' . http_build_query(array( 'title' => 'Special:Translate', -- 2.39.5