Index: /CKLangTool/trunk/_source/includes/cklangtool.js
===================================================================
--- /CKLangTool/trunk/_source/includes/cklangtool.js	(revision 7297)
+++ /CKLangTool/trunk/_source/includes/cklangtool.js	(revision 7298)
@@ -12,4 +12,12 @@
 	templateFile : "",
 	format : "json",
+	/**
+	 * (Transifex) Language mappings.
+	 * The same language may have a different language code in Transifex and in CKEditor.
+	 * An associative array where "Transifex" language code is the key, and value is the "CKEditor" language code.
+	 * Sample mapping:
+	 * CKLANGTOOL.txLangMap[sr@latin] = sr-latn
+	 */
+	txLangMap : {},
 	/**
 	 * Holds the content of en.js language file where strings are replaced with
@@ -120,10 +128,11 @@
 				var pom = parsePO( CKLANGTOOL.io.readFile( file ) ),
 					headers = pom[ '' ],
-					languageCode = headers.language;
-
-				if ( languageCode.toLowerCase() != stripExtension(file.getName()).toLowerCase() )
-				{
-					throw ( "Language file does not seem to be valid.\n" +
-							"Language code (" + languageCode + ") and the name of the file (" + file.getName()+ ") do not match.\n" +
+					languageCode = headers.language,
+					fileNameWithoutExt = stripExtension(file.getName());
+
+				if ( languageCode.toLowerCase() != fileNameWithoutExt.toLowerCase() && ( !CKLANGTOOL.txLangMap[languageCode] || CKLANGTOOL.txLangMap[languageCode] != fileNameWithoutExt ) )
+				{
+					throw ( "ERROR: Language file does not seem to be valid.\n" +
+							"Language code (" + languageCode + ") and the name of the file (" + file.getName() + ") do not match.\n" +
 							"Is the following file valid: " + file.getAbsolutePath() + " ?\n" );
 				}
@@ -244,5 +253,6 @@
 		translation :Pattern.compile( "#ckeditor_translation[^#]*?#" ),
 		ckeditorLang :Pattern.compile( "(.*CKEDITOR\\.lang\\[).*?(\\]\\s*=.*)" ),
-		ckeditorSetLang :Pattern.compile( "(.*CKEDITOR\\.plugins\\.setLang\\s*\\(.*?,)\\s*['\"][a-z-]+['\"](.*)" )
+		ckeditorSetLang :Pattern.compile( "(.*CKEDITOR\\.plugins\\.setLang\\s*\\(.*?,)\\s*['\"][a-z-]+['\"](.*)" ),
+		langMap : Pattern.compile( "lang_map\\s*=\\s*(.*)" )
 	};
 
@@ -604,11 +614,17 @@
 		var string = CKLANGTOOL.template;
 		var matcher = regexLib.translation.matcher( string );
-		var found = 0, missing = 0;
+		var info, found = 0, missing = 0;
 		var result = CKLANGTOOL.loadLanguageFile( file );
 		var translation = result.translation;
 		languageCode = result.languageCode;
 
-		var dst = new File( CKLANGTOOL.languageDir, languageCode + '.js' );
-		var info = CKLANGTOOL.analyzeLanguageFile( dst );
+		var dst = new File( CKLANGTOOL.languageDir, ( CKLANGTOOL.txLangMap[languageCode] ? CKLANGTOOL.txLangMap[languageCode] : languageCode ) + '.js' );
+		if ( !dst.exists() ) {
+			print( 'Destination file does not exist: ' + dst );
+			info = { missingKeys : [], fileOverviewBlock : '' };
+		}
+		else {
+			info = CKLANGTOOL.analyzeLanguageFile( dst );
+		}
 		// No mark missing support in other formats.
 		var missingKeys =  CKLANGTOOL.format == CKLANGTOOL.FORMAT_JSON ? info.missingKeys : {};
@@ -689,8 +705,36 @@
 	}
 
+	/**
+	 * Load Transifex client configuration
+	 * Currently, only the "lang_map" configuration option is used
+	 * Sample configuration:
+	 * lang_map = el: el_GR, sr@latin:sr_latin
+	 */
+	function loadConfiguration()
+	{
+		if (!CKLANGTOOL.configFile)
+			return;
+		var languages, lines = CKLANGTOOL.io.readFileIntoArray(CKLANGTOOL.configFile);
+		for (var i = 0 ; i < lines.length ; i++)
+		{
+			matcher = regexLib.langMap.matcher( lines[i] );
+			if ( matcher.find() )
+			{
+				languages = matcher.group( 1 ).split(',');
+				for (var j = 0 ; j < languages.length ; j++)
+				{
+					var map = String(languages[j]).replace(/^\s\s*/, '').replace(/\s\s*$/, '').split(':');
+					// CKLANGTOOL.txLangMap[sr@latin] = sr_latin
+					CKLANGTOOL.txLangMap[map[0]] = map[1];
+				}
+			}
+		}
+	}
+
 	CKLANGTOOL.translator.prototype =
 	{
 		run : function( transDir )
 		{
+			loadConfiguration();
 			CKLANGTOOL.template = CKLANGTOOL.translator.createTemplate( CKLANGTOOL.templateFile );
 			var result = CKLANGTOOL.loadLanguageFile( CKLANGTOOL.templateFile );
Index: /CKLangTool/trunk/_source/langtool.js
===================================================================
--- /CKLangTool/trunk/_source/langtool.js	(revision 7297)
+++ /CKLangTool/trunk/_source/langtool.js	(revision 7298)
@@ -72,5 +72,6 @@
 			+ '\n\t getext - The versatile GNU Gettext format, simplified to fit for CKEditor.'
 			+ '\n\t jprops - The Java Properties file format.'
-		   + '\n[-m|--metafile]=path  Specify the path to an optional meta file which used only by the Gettext format for context information.'
+			+ '\n[-m|--metafile]=path  Specify the path to an optional meta file which used only by the Gettext format for context information.'
+			+ '\n[-c|--config]=path  Specify the path to an optional configuration file.'
 			+ '\n' );
 
@@ -109,4 +110,10 @@
 			if ( !CKLANGTOOL.metaFile.exists() )
 				error( 'Meta file does not exist: ' + CKLANGTOOL.metaFile.getAbsolutePath() );
+		}
+		else if ( match = arg.match( /^(?:-c|--config)=(.*?)$/ ) )
+		{
+			CKLANGTOOL.configFile = new File( match[ 1 ] );
+			if ( !CKLANGTOOL.configFile.exists() )
+				error( 'Configuration file does not exist: ' + CKLANGTOOL.configFile.getAbsolutePath() );
 		}
 		else if ( !langDir )
