Changeset 7311


Ignore:
Timestamp:
11/10/11 11:25:33 (4 years ago)
Author:
wwalc
Message:

CKLangTool can now generate meta files.

Location:
CKLangTool/trunk
Files:
5 added
5 edited

Legend:

Unmodified
Added
Removed
  • CKLangTool/trunk/_dev/build.xml

    r7088 r7311  
    2727                        <arg value="${source.dir}/includes/cklangtool.js" />
    2828                        <arg value="${source.dir}/includes/ckjpformat.js" />
     29                        <arg value="${source.dir}/includes/ckmetaformat.js" />
    2930                        <arg value="${source.dir}/includes/ckpoformat.js" />
    3031                        <arg value="${source.dir}/includes/po_parser.js" />
     
    3940                <copy file="${source.dir}/includes/cklangtool/includes/cklangtool.class" tofile="${build.dir}/cklangtool/includes/cklangtool.class" overwrite="true" />
    4041                <copy file="${source.dir}/includes/cklangtool/includes/ckjpformat.class" tofile="${build.dir}/cklangtool/includes/ckjpformat.class" overwrite="true" />
     42                <copy file="${source.dir}/includes/cklangtool/includes/ckmetaformat.class" tofile="${build.dir}/cklangtool/includes/ckmetaformat.class" overwrite="true" />
    4143                <copy file="${source.dir}/includes/cklangtool/includes/ckpoformat.class" tofile="${build.dir}/cklangtool/includes/ckpoformat.class" overwrite="true" />
    4244                <copy file="${source.dir}/includes/cklangtool/includes/po_parser.class" tofile="${build.dir}/cklangtool/includes/po_parser.class" overwrite="true" />
  • CKLangTool/trunk/_source/langtool.js

    r7298 r7311  
    5656CKLANGTOOL.load( 'cklangtool.includes.ckjpformat' );
    5757CKLANGTOOL.load( 'cklangtool.includes.ckpoformat' );
     58CKLANGTOOL.load( 'cklangtool.includes.ckmetaformat' );
    5859CKLANGTOOL.load( 'cklangtool.includes.po_parser' );
    5960CKLANGTOOL.load( 'cklangtool.includes.io' );
     
    6869
    6970                        + '\n\nOptions:'
    70                         + '\n[-f|--format]=json|gettext|jprops  Format of language file when update from or export translation entries to, default to json.'
     71                        + '\n[-f|--format]=json|gettext|jprops|meta  Format of language file when update from or export translation entries to, default to json.'
    7172                        + '\n\t json - A private JavaScript format used as runtime language files in CKEditor.'
    72                         + '\n\t getext - The versatile GNU Gettext format, simplified to fit for CKEditor.'
     73                        + '\n\t gettext - The versatile GNU Gettext format, simplified to fit for CKEditor.'
    7374                        + '\n\t jprops - The Java Properties file format.'
     75                        + '\n\t meta - The meta file with context information (used by the gettext method).'
    7476                        + '\n[-m|--metafile]=path  Specify the path to an optional meta file which used only by the Gettext format for context information.'
    7577                        + '\n[-c|--config]=path  Specify the path to an optional configuration file.'
     
    159161if ( action == 'update' )
    160162{
    161         var translator = new CKLANGTOOL.translator();
    162         translator.run( CKLANGTOOL.destinationDir || CKLANGTOOL.languageDir );
     163        if ( CKLANGTOOL.format == 'meta' )
     164        {
     165                new CKLANGTOOL.meta().run();
     166        }
     167        else
     168        {
     169                var translator = new CKLANGTOOL.translator();
     170                translator.run( CKLANGTOOL.destinationDir || CKLANGTOOL.languageDir );
     171        }
    163172}
    164173// Export translations to other formats.
  • CKLangTool/trunk/test/test.js

    r7294 r7311  
    9999                        error( "Can't create temp directory: " + tempDir );
    100100
    101                 var tests = [ 'gettext', 'gettext/out', 'jprops', 'jprops/out', 'translator', 'translator2' ];
     101                var tests = [ 'gettext', 'gettext/out', 'jprops', 'jprops/out', 'translator', 'translator2', 'meta', 'meta/out' ];
    102102
    103103                for ( var i = 0 ; i < tests.length ; i++ )
     
    149149                CKLANGTOOL.destinationDir = new File( tmpDir + '/out' );
    150150                CKLANGTOOL.templateFile = new File( tmpDir, 'en.js' );
    151                
     151
     152                if ( format == 'meta' )
     153                {
     154                        CKLANGTOOL.metaFile = '_assets/meta/meta.txt';
     155                }
    152156                var dir = new File( '_assets/' + format );
    153157                var dirList = dir.list();
     
    184188        testFormat('gettext');
    185189        testFormat('jprops');
     190        testFormat('meta');
    186191
    187192        print( '' );
Note: See TracChangeset for help on using the changeset viewer.
© 2003 – 2015 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy