How to use the @ckeditor/ckeditor5-dev-utils.cleanPoFileContent function in @ckeditor/ckeditor5-dev-utils

To help you get started, we’ve selected a few @ckeditor/ckeditor5-dev-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ckeditor / ckeditor5-dev / packages / ckeditor5-dev-env / lib / translations / download.js View on Github external
function saveTranslations( packageName, translations ) {
	const languageCodeMap = require( './languagecodemap.json' );
	let savedTranslations = 0;

	for ( let [ lang, poFileContent ] of translations ) {
		if ( !isPoFileContainingTranslations( poFileContent ) ) {
			continue;
		}

		if ( lang in languageCodeMap ) {
			lang = languageCodeMap[ lang ];
		}

		poFileContent = cleanPoFileContent( poFileContent );

		const pathToSave = path.join( process.cwd(), 'packages', packageName, 'lang', 'translations', lang + '.po' );

		fs.outputFileSync( pathToSave, poFileContent );
		savedTranslations++;
	}

	logger.info( `Saved ${ savedTranslations } PO files for ${ packageName } package.` );
}