ePages 7.28.0 - DE_EPAGES/Test/API/TranslationJS.pm

Package DE_EPAGES::Test::API::TranslationJS

Checks translation files (de/en) for correct encoding: iso-8859-1

Base
DE_EPAGES::Test::API::StoreUnitTest

Functions

CheckGeneralUseOfDictionaries
CheckMissingTranslations
CheckTranslationList
CheckUnUsedTranslations

CheckGeneralUseOfDictionaries

Check the general use of dictionaries in js modules.

Syntax
CheckGeneralUseOfDictionaries($hJS2Dict, $hDicts);
Input
$hJS2Dict (hash.refs)
hash of js modules paths as keys and values see
_GetJSDictRequire
$hDicts (hash.ref)
hash of dictionaries

CheckMissingTranslations

Check if js module and module template use unknown translation.

Syntax
CheckMissingTranslations($hJS2Dict, $hDicts, $hCompleteDicts);
Input
$hJS2Dict (hash.refs)
hash of js modules paths as keys and values see
_GetJSDictRequire
$hDicts (hash.ref)
hash of dictionaries
$hCompleteDicts (hash.ref)
hash with translations foreach dictionary

CheckTranslationList

Applies to the ePages JavaScript API, based on jQuery. If a JS module uses a function call to our dictionary like: this.dict.translate(...) the module MUST contain a declaration of the used language tags like: /* * @dictionary ep.dict * * @translation * {Today} * {Done} */

Syntax
CheckTranslationList($rContent);
Example
if(!$CheckTranslationList($rFileContent)) { print "error ..."; }
Input
$rContent (ref.string)
javascript source code file content
Return
0 or 1 (boolean)
1 if no problem could be found, otherwise 0

CheckUnUsedTranslations

Check if dictionaries have unnecessary translation.

Syntax
CheckUnUsedTranslations($hJS2Dict, $hDicts, $hCompleteDicts);
Input
$hDict2JSFile (hash.ref)
hash of dictionary paths as keys and values are arrays of
return value of _GetJSDictRequire
$hCompleteDictsWithOutInheritance (hash.ref)
hash with translations foreach
dictionary