Select the language of the calendar for Gantt diagrams

+3 votes
asked Jan 8, 2018 in Wanted features by Lyudline
Hi everyone!

I found out that Gantt diagrams in PlantUML offers the possibility to display the project on a calendar instead of an array of numbered columns. This is a great idea, but it lacks of international support: months and days abbreviations will be generated in English.

Users should be able to select a language or to redefine the existing words. The syntax in the first case could use the ISO code of the language - my suggestion for the syntax tries to respect the natural language used for these diagrams. For example, for French from France :

Language is fr_FR

In the second case, there could be something like :

"september" changes to "septembre"
"Fr" changes to "Ve"

2 Answers

0 votes
answered Jun 3, 2021 by The-Lu (64,340 points)

Hello L, and PlantUML team,

Here is a proposal from Mike for a Change Request or a PR, on:

According to their source code, there are hardcoded values for days and months as Enums and they use name() method to get their English names. I would recommend you to clone their repo and change the hardcoded values in two classes:

1. In file src/net/sourceforge/plantuml/project/time/DayOfWeek.java replace method shortName like this:

  public String shortName() {
    Locale locale = Locale.getDefault();
    String s = StringUtils.capitalize(java.time.DayOfWeek.valueOf(this.toString()).getDisplayName(TextStyle.SHORT_STANDALONE, locale));
    return s.substring(0,2);
  }

2. In file src/net/sourceforge/plantuml/project/time/Month.java replace two methods like this

 public String shortName() {
 return StringUtils.capitalize(java.time.Month.valueOf(this.toString()).getDisplayName(TextStyle.SHORT_STANDALONE,Locale.getDefault()));
}

and

    public String longName() {
    return StringUtils.capitalize(java.time.Month.valueOf(this.toString()).getDisplayName(TextStyle.FULL_STANDALONE,Locale.getDefault()));
   }

I compile only these two classes and replace them in jar file. This works for me.

Mike.

@PlantUML: Could you implement that? or add a parameter to define the locale on Gantt diagram?

Thank to Mike, and PlantUML team,
Regards,
Th.

+1 vote
answered Jun 11, 2021 by plantuml (295,000 points)

With last beta http://beta.plantuml.net/plantuml.jar you can now specify a language for the Calendar. For example:

@startgantt
Language DE
Project starts the 20th of september 2017
...
@endgantt

This will be integrated in next official release. Hope this helps!

...