The pain of unused labels is felt when you start
translating your application to support the global versions. As we were porting
our application to German we were seeing every possible way to speed up the
translation work, one of it was to avoid translating unused labels. So we
tried a few tools that helps us identify this but unfortunately nothing turned
helpful. We then resorted to invent our own strategy ….
I’m just reposting what my colleague had already
posted on his blog with little more detail and a few additions …
*This job works only if your cross reference is
updated*
view
sourceprint?
static void
FindUnUsedLabels()
{
str 50 labelId;
str labelString;
int i;
//set max label to the highest number of labelId in your
application
int maxLabel = 2500;
xRefNames names;
XRefReferences ref;
;
while (i <= maxLabel)
{
//Sequential generation
labelId
= "@SYS" + int2str(i);
//Find if the label id has an cross reference
//record
select recid from
names
where
names.Name == labelid
exists join
ref
where names.RecId == ref.xRefNameRecId;
labelString = SysLabel::labelId2String(labelId);
//If there is no record in cross reference then log it
if (! names.RecId &&
//avoid logging labels that are already deleted (This is
because of sequential check like IFC1, IFC2, IFC3 etc...)
labelString != labelId)
{
info(strfmt("%1 - %2\n", labelId,
SysLabel::labelId2String(labelId)));
}
i++;
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.