Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@ckeditor/ckeditor5-dev-translations
Advanced tools
CKEditor 5 translations plugin for webpack.
@ckeditor/ckeditor5-dev-translations is a development tool for CKEditor 5 that helps in managing translations. It allows developers to extract, compile, and manage translation files for CKEditor 5 plugins and applications.
Extracting Translations
This feature allows you to extract translation strings from your source files into a .pot file, which can then be used for translation purposes.
const { extract } = require('@ckeditor/ckeditor5-dev-translations');
extract({
sourceFiles: 'src/**/*.js',
translationsOutputFile: 'build/.transifex-messages.pot'
});
Compiling Translations
This feature compiles translation files from a specified directory into a format that can be used by CKEditor 5, supporting multiple languages.
const { compile } = require('@ckeditor/ckeditor5-dev-translations');
compile({
translationsDirectory: 'translations',
outputDirectory: 'build/translations',
languages: ['en', 'es', 'fr']
});
i18next is a popular internationalization framework for JavaScript that provides a complete solution for localizing applications. Unlike @ckeditor/ckeditor5-dev-translations, which is specific to CKEditor 5, i18next is a general-purpose library that can be used with any JavaScript application.
react-intl is a library for internationalizing React applications. It provides components and an API to format dates, numbers, and strings, and to handle pluralization. While @ckeditor/ckeditor5-dev-translations is specific to CKEditor 5, react-intl is tailored for React applications.
gettext-parser is a library for parsing and compiling gettext files (.po, .mo). It is similar to @ckeditor/ckeditor5-dev-translations in that it deals with translation files, but it is not specific to CKEditor 5 and can be used in any project that uses gettext for translations.
Integrate CKEditor 5's build process with your webpack setup.
Requires webpack ^4.0.0
or ^5.0.0
.
More information about development tools packages can be found at the following URL: https://github.com/ckeditor/ckeditor5-dev.
The current functionality of this plugin is limited to localizing the editor builds. Add this plugin to your webpack configuration to change the language of the editor's interface or build the editor with support for multiple languages (by extracting multiple language files):
const { CKEditorTranslationsPlugin } = require( '@ckeditor/ckeditor5-dev-translations' );
// Define webpack plugins ...
plugins: [
new CKEditorTranslationsPlugin( options ),
// Other webpack plugins...
]
// ...
language
The main language that will be built into the main bundle, e.g. en
.
additionalLanguages
Additional languages that will be emitted to the outputDirectory
. This option can be set to an array of language codes or 'all'
to build all found languages. The bundle is optimized for one language when this option is omitted.
outputDirectory
An optional directory for emitted translations. Relative to the webpack's output. Defaults to 'translations'
.
strict
When set to true
, it stops the webpack compilation when an error occurs. Defaults to false
.
verbose
When set to true
, it logs all warnings found during the compilation. Defaults to false
.
addMainLanguageTranslationsToAllAssets
When set to true
, all generated assets (bundles) will include translations for the main language.
buildAllTranslationsToSeparateFiles
When set to true
, all translations will be output to the translations
directory (or the directory specified by the outputDirectory
option).
packageNamesPattern
A pattern which is used for determining if a package may contain translations (PO files) in the <package_name>/lang/translations
directory. Defaults to /[/\\]ckeditor5-[^/\\]+[/\\]/
.
sourceFilesPattern
A pattern which is used for determining if a file may contain messages to translate. Defaults to /[/\\]ckeditor5-[^/\\]+[/\\]src[/\\].+\.js$/
.
translationsOutputFile
An option that allows specifying the target file to which all translations will be outputted. This option supports a string, regular expression and a function. If no asset exists with the name, it will be created automatically and filled with translations.
includeCorePackageTranslations
When set to true
, all translations from the ckeditor5-core
package will be added into the bundle files. Defaults to false
.
skipPluralFormFunction
When set to true
, the getPluralForm()
function (if exists for the specified language) will not be added into the bundle file. Defaults to false
.
assetNamesFilter
A function to filter assets importing CKEditor 5 modules. Potential performance boost for applications with many webpack entry points. It allows disabling the CKEditorTranslationsPlugin
plugin for an entry point not containing imports CKEditor 5 modules. Defaults to name => name.endsWith( '.js' )
.
corePackagePattern
(internal)
A pattern which is used to get a path to the core translation package from corePackageSampleResourcePath
, which contains the main translations. Defaults to /[/\]ckeditor5-core/.
corePackageSampleResourcePath
(internal)
A sample path to the ckeditor5-core
package. A test import to this file shows if the ckeditor5-core
package is available and allows to load the core package translations first.
corePackageContextsResourcePath
(internal)
A path the context.json
file in the ckeditor5-core
package. It is used if the includeCorePackageTranslations
option is set to true
.
You can read more about localizing the editor in the Setting the UI language guide.
See the CHANGELOG.md
file.
Licensed under the terms of GNU General Public License Version 2 or later. For full details about the license, please check the LICENSE.md
file.
FAQs
CKEditor 5 translations plugin for webpack.
The npm package @ckeditor/ckeditor5-dev-translations receives a total of 103,310 weekly downloads. As such, @ckeditor/ckeditor5-dev-translations popularity was classified as popular.
We found that @ckeditor/ckeditor5-dev-translations demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.