mardi 23 août 2011

How can we do to export label of langage

void clicked()
{
    LabelId labelId;
    Label labelfr;
    int64 MaxLabelfr;
    Label labelen;
    int64 MaxLabelen;
    Label labelenus;
    int64 MaxLabelenus;
    Label labelde;
    int64 MaxLabelde;
    str labelString;
    str labelComment;
    Str ModuleId;
    Str LangageIdStr="fr";
    int64 i;
    str LineExport;
    str Emptystr=";;";
    boolean LabelEnglish=false;
    boolean LabelEnglishUs=false;
    boolean LabelDeutsch=false;
    #File
    TextIo                  FileToWrite;
    container               c;


    super();
    if(CheckBoxEn.value()==1)
        LabelEnglish=true;
    if(CheckBoxEnUs.value()==1)
        LabelEnglishUs=true;
    if(CheckBoxDe.value()==1)
        LabelDeutsch=true;
    ModuleId = Group_ModuleId.text();
    FileToWrite = new TextIo(Group_FileName.text(), #io_write,0);//#io_read  lecture par defaut,#io_read write par defaut;
    if (!FileToWrite)
    {
        throw error("@SYS577");
    }

    labelfr   = new Label("fr");
    MaxLabelfr = labelfr.maxLabelId(ModuleId);
    LineExport ="LabelId;Libellé;Description";

    if(LabelEnglish)
    {
        labelen   = new Label("en");
        MaxLabelen = labelen.maxLabelId(ModuleId);
        if(MaxLabelen >  MaxLabelfr)
            MaxLabelfr = MaxLabelen;
        Emptystr =Emptystr+";;";
        LineExport =LineExport+";Label;Description";
    }
    if(LabelEnglishUs)
    {
        labelenus   = new Label("en-us");
        MaxLabelenus = labelenus.maxLabelId(ModuleId);
        if(MaxLabelenus >  MaxLabelfr)
            MaxLabelfr = MaxLabelenus;
        Emptystr =Emptystr+";;";
        LineExport =LineExport+";Label;Description";
    }
    if(LabelDeutsch)
    {
        labelde   = new Label("de");
        MaxLabelde = labelde.maxLabelId(ModuleId);
        if(MaxLabelde >  MaxLabelfr)
            MaxLabelfr = MaxLabelde;
        Emptystr =Emptystr+";;";
        LineExport =LineExport+";Wortlaut;Beschreibung";
    }


    FileToWrite.write(LineExport);
    for (i = 1; i <= MaxLabelfr; i++)
        {
            LineExport ="";
            labelId = '@'+ModuleId+int642str(i);
            labelString = labelfr.extractString(labelId);
            if(strScan(labelString,"@"+ModuleId,0,100)>0)
                labelString ="";
            labelComment = labelfr.extractComment(labelId);
            labelComment = element.Format(labelComment);
            LineExport = ";"+labelString+";"+labelComment;
            if(LabelEnglish)
            {
                labelString = labelen.extractString(labelId);
                if(strScan(labelString,"@"+ModuleId,0,100)>0)
                    labelString ="";
                labelComment = labelen.extractComment(labelId);
                labelComment = element.Format(labelComment);
                LineExport = LineExport+";"+labelString+";"+labelComment;
            }

            if(LabelEnglishUs)
            {
                labelString = labelenus.extractString(labelId);
                if(strScan(labelString,"@"+ModuleId,0,100)>0)
                    labelString ="";
                labelComment = labelenus.extractComment(labelId);
                labelComment = element.Format(labelComment);
                LineExport = LineExport+";"+labelString+";"+labelComment;
            }

            if(LabelDeutsch)
            {
                labelString = labelde.extractString(labelId);
                if(strScan(labelString,"@"+ModuleId,0,100)>0)
                    labelString ="";
                labelComment = labelde.extractComment(labelId);
                labelComment = element.Format(labelComment);
                LineExport = LineExport+";"+labelString+";"+labelComment;
            }



            if( LineExport !=Emptystr)
            {
                LineExport = labelId+LineExport;

                FileToWrite.write(LineExport);
            }
        }
    Box::info("@SYS570");
}

Aucun commentaire:

Enregistrer un commentaire