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 Answers 2

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.

0

There's a way to do it using table dynamic text. Similar to the answer above, but it outputs regular old text, not a label. First you need a table of month numbers and names, and you use an SQL query:

<dyn type="table" property="value" mapFrame="Layers Map Frame" 
mapMemberUri="CIMPATH=YOUR_MAP_FRAME_NAME/TABLE_WITH_MONTHS.xml" 
sql="'Field containing month number' = EXTRACT(MONTH FROM CURRENT_DATE())" 
field="'Field containing month names'" delimiter=" "/> <dyn type="date" format="yyyy"/>

Where you replace YOUR_MAP_FRAME_NAME/TABLE_WITH_MONTHS.xml with said values, and 'Field containing month number/year' should be just those field names without single quotes.

I hope that's clear enough and helps anyone else who comes across this 5 or more years after it was first asked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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