Showing posts with label Labels. Show all posts
Showing posts with label Labels. Show all posts

Friday, July 2, 2021

Some ISV/Custom labels not resolved when migrated from AX 2012 to D365FO

 After migration from AX 2012 to D365FO I noticed a strange thing with one ISV module labels.

Some of them are perfectly resolved by their old notation with @ in the reference; but none in a new style.




As suggested by Muthusamy V in this old thread https://community.dynamics.com/365/financeandoperations/f/dynamics-365-for-finance-and-operations-forum/312828/label-issues-in-sdp-deployment?pifragment-109037=2#responses

and explained by one of my colleagues, I simply need to delete these files from K:\AosService\PackagesLocalDirectory\ApplicationSuite\ folder. (All D365FO service must be stopped)


Then it works well.





Saturday, November 26, 2016

Back slashing menu items

It turned out to be a wrong decision to use a back slash character in menu item label. When it is used then in a menu, nothing tells you that something is wrong.



However, no chance to run this menu item from the menu.
So, avoid this and, maybe, other illegal characters for labeling your menu items.

Friday, November 21, 2014

How to print labels in multiple languages

This is a short job to print labels in English US and English Canada. The prefix defines the label file.

static void printLabels(Args _args)
{
    int     labelNum = 1;
    int     labelIndex;
    int     labelMaxNum = 216;
    str     labelPrefix = "@CGI";
    str     labelStr;
    str     languageIdEN = 'en-us';
    str     languageIdFR = 'en-ca';

    for (labelIndex = labelNum; labelIndex <= labelMaxNum; labelIndex++)
    {
        labelStr = labelPrefix + int2str(labelIndex);
        labelStr = strFmt("%1 : %2 /// %3", labelStr,
                                            SysLabel::labelId2String2(strFmt("%1", labelStr), languageIdEN),
                                            SysLabel::labelId2String2(strFmt("%1", labelStr), languageIdFR));
        info( labelStr);
    }
}

Wednesday, November 5, 2014

Labels and Best Practices




Guys, please, do not forget that AX is really multilingual system and there are many other languages than English. Happy labelling!

Tuesday, March 16, 2010

All Lables from given Layer in given Languages

Sometimes I need to see a label translations into different languages. Sometimes it is good to see all the labels that were created during the project on a given layer - like those on USR.

This job exports all labels from a given layer in given languages to an Excel file.

Here I used the two following code examples from the AXForum.info:

Firstly, the job calculates the number of labels; then, it shows progress window; finally, it opens an Excel file saved under the name like "Labels from "+#LayerId+ " in "+#English+", "+#French+", "+#Russian+".xls".

In this particular job are SYS layer and three mentioned languages used; you can easily change them to your needs.



static void SisPrintAllLabelsOnGivenLanguages(Args _args)
{
    // needed layer
    #define.LayerId("SIS")
    // all needed languages
    #define.English("en-us")
    #define.French("fr-ca")
    #define.Russian("ru")
    // label classes
    Label   lEn = new Label(#English);
    Label   lFr = new Label(#French);
    Label   lRu = new Label(#Russian);
    // start looking every label
    str 250 lId;
    int totalLabels;
    RunbaseProgress         progress;
    #macrolib.AviFiles
    //Excel variables section
    COM rstAxa = new COM('ADODB.Recordset');    // ADO: Recordset
    COM flds   = rstAxa.Fields();
    COM fld;
    #define.LabelId("LabelId")
    COM xlApp;            
    COM wbks, wbk;        
    COM wkss, wks;        
    COM rng, cell, rngCR; 
    COM font;             
    COM entCol;           
    COM actWin;           
    int i, iMax;
    ;
    print("@SYS34745");
    // start looking every label
    lId = lEn.searchFirst('');
    while (lId)
    {
        if (lEn.moduleId(lId) == #LayerId) // The particular label file
        {
            // count labels
            totalLabels++;
        }
        lId = lEn.searchNext();
    }
    print(strfmt("%1 = %2", "@SYS54695", totalLabels));
    print("@SYS76178");
    if (totalLabels<=0)
        return;

    progress = RunbaseProgress::construct(1,null);

    progress.setCaption("@SYS76178");
    progress.setTotal(totalLabels);
    progress.setAnimation(#AviPrint);

    // <--- create excel fields in a worksheet
    flds.Append(#LabelId, 8);
    flds.Append(#English, 8);
    flds.Append(#French, 8);
    flds.Append(#Russian, 8);
    rstAxa.Open();

    xlApp = new COM('Excel.Application');
    xlApp.Visible(false);
    wbks = xlApp.Workbooks();
    wbk  = wbks.Add();
    wkss = wbk.Worksheets();
    wks  = wkss.Item(1);
    wks.Name("Labels");
    rng  = wks.Range('A1');
    flds = rstAxa.Fields();
    iMax = flds.Count() - 1;
    for (i = 0; i <= iMax; i += 1)
    {
        fld = flds.Item(i);
        cell = rng.Offset(0, i);
        cell.Value2(fld.Name());
    }
    rngCR = rng.CurrentRegion();
    font = rngCR.Font();
    font.Bold(true);
    cell = rng.Offset(1, 0);
    // <--- end of creating of excel fields in a worksheet

    lId = lEn.searchFirst('');
    while (lId)
    {
        if (lEn.moduleId(lId) == #LayerId) // The particular label file
        {
            // print to excel
            progress.incCount();
            rstAxa.AddNew();
            fld = flds.Item(#LabelId);  fld.Value(lId);
            fld = flds.Item(#English);  fld.Value(lEn.extractString(lId));
            fld = flds.Item(#French);   fld.Value(lFr.extractString(lId));
            fld = flds.Item(#Russian);  fld.Value(lRu.extractString(lId));
            rstAxa.Update();
        }
        lId = lEn.searchNext();
    }
    cell.CopyFromRecordset(rstAxa);
    progress.kill();
    // format excel worksheet
    rngCR = rng.CurrentRegion();
    entCol = rngCR.EntireColumn();
    entCol.AutoFit();
    cell.Select();
    actWin = xlApp.ActiveWindow();
    actWin.FreezePanes(true);
    rstAxa.Close();
    xlApp.Visible(true);
    wbk.SaveAs("Labels from "+#LayerId+ " in "+#English+", "+#French+", "+#Russian+".xls");
}