Hi
If you have to import many Label files in different languages into AX 2012, you can use the script below.
If the label file doesn’t exists, it will be created at the current level.
This operation will overwrite any existing label different from file.
str path = @"C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\Application\Appl\Standard\";
container files = ["axXXX","axYYY"
];
container extensions = [ "en-us.ald",
"en-gb.ald",
"it.ald",
"fr.ald",
"fr-be.ald",
"de.ald",
"es.ald",
"zh-cn.ald" ];
FilenameOpen file;
#WINAPI
int i;
int j;
SysLabelFile labelFile;
for(i=1; i<=conLen(files); i++)
{
for(j=1; j<=conLen(extensions); j++)
{
file = path + conPeek(files, i) + conPeek(extensions, j);
if( WinAPI::fileExists(file)) // check file exists
{
// In AX 2012 there are 2 files for chinese, so we copy(overwrite) the old file in the user desktop with the new name
if( conPeek(extensions, j) == "zh-cn.ald")
{
WinAPI::copyFile(file, WinAPI::getFolderPath(#CSIDL_DESKTOP) + @"\" + conPeek(files, i) + "zh-hans.ald", true);
file = WinAPI::getFolderPath(#CSIDL_DESKTOP) + @"\" + conPeek(files, i) + "zh-hans.ald";
}
// create from file
labelFile = SysLabelFile::newFilename(file);
labelFile.fromFile(file);
}
else
warning(strFmt("File %1 not found", file));
}
}
That's it!
If you have to import many Label files in different languages into AX 2012, you can use the script below.
If the label file doesn’t exists, it will be created at the current level.
This operation will overwrite any existing label different from file.
str path = @"C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\Application\Appl\Standard\";
container files = ["axXXX","axYYY"
];
container extensions = [ "en-us.ald",
"en-gb.ald",
"it.ald",
"fr.ald",
"fr-be.ald",
"de.ald",
"es.ald",
"zh-cn.ald" ];
FilenameOpen file;
#WINAPI
int i;
int j;
SysLabelFile labelFile;
for(i=1; i<=conLen(files); i++)
{
for(j=1; j<=conLen(extensions); j++)
{
file = path + conPeek(files, i) + conPeek(extensions, j);
if( WinAPI::fileExists(file)) // check file exists
{
// In AX 2012 there are 2 files for chinese, so we copy(overwrite) the old file in the user desktop with the new name
if( conPeek(extensions, j) == "zh-cn.ald")
{
WinAPI::copyFile(file, WinAPI::getFolderPath(#CSIDL_DESKTOP) + @"\" + conPeek(files, i) + "zh-hans.ald", true);
file = WinAPI::getFolderPath(#CSIDL_DESKTOP) + @"\" + conPeek(files, i) + "zh-hans.ald";
}
// create from file
labelFile = SysLabelFile::newFilename(file);
labelFile.fromFile(file);
}
else
warning(strFmt("File %1 not found", file));
}
}
That's it!
No comments:
Post a Comment