AnsweredAssumed Answered

Setting Label Class Language - ArcGIS Pro

Question asked by coudert on Feb 5, 2019
Latest reply on Feb 6, 2019 by wharrison-esristaff

How can I set the Language for a Label Class from Python?  The code below works only if the language has been manually set to Python.  I would like to be able to set the language from within the code.

 

Edit: Asked a different way, is there a way to determine what the current setting is for Language in the Label Class?  With this information, the returned expression format can match the current Language setting.

 

aprx = arcpy.mp.ArcGISProject('CURRENT')
m = aprx.listMaps()[0]
lyr = m.listLayers()[0]
if lyr.supports('SHOWLABELS'):
    lyr.listLabelClasses()[0].expression = '\'<FNT name="Arial" size="8">\' + str([targetMap_STATEFP]) + \'</FNT>\''
    lyr.listLabelClasses()[0].visible = True
m.listLayers()[0].showLabels = True

Outcomes