3

Being in a bilingual (English/French) organisation, I want to add dynamic text showing the date in both languages. I have a line that shows English month/year but since my ArcGIS is in English, by default, the month is written in English.

Is there a way or a tag that sets language?

2

As far as I can see, dynamic labels do not support different cultures, nor is there any support for logic to replace e.g. the month number with a text.

The only workaround I can think of is an ugly one: Create a dummy featureclass containing a single feature, and add it to a secondary dataframe. Place the dataframe on the pagelayout wherever you want the date.

Then, set the layer’s label expression to the following (this sample will just print the date in French). The Advanced checkbox should be checked, and Parser should be set to Python.

now = datetime.datetime.now()
months = ["", "janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"]

def FindLabel (  ):
    return "Current date: {0} {1} {2}".format(now.day, months[now.month], now.year)

Furthermore, note that the array of month names starts with an empty string. This is because now.month return the month as 1–12, whereas an array starts counting at 0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.