Ordinal day of month in Portuguese

AI-generated summary

The discussion revolves around translating date formats in Discourse to European Portuguese. plipsqueek is having trouble finding a way to translate the ordinal day of the month format used in the Cakeday menu. Currently, it displays as “abril 5º” instead of the desired “5 abril”. Falco identified the issue as a bug in the plugin, which isn’t using localized formats. He suggested a fix using customized localized formats in the code. tgxworld has since fixed the issue in a commit to the discourse-cakeday repository, thanking plipsqueek for reporting the problem and Falco for his help.

Hello. I’d like to start by saying that I’m new to Discourse and I’ve been pushing the translation of Discourse into European Portuguese and it’s coming along great. It is truly a great piece of software that is very enjoyable to use!

I’ve been having some issues finding a proper way of translating the way that the dates are shown in the Cakeday menu. Here is how they look right now:

The relevant part is the one that lists the birthdays between a time interval. It seems the dates are represented with an ordinal number (as in 1st of April, 2nd, 3rd, etc). In Portugal we not only don’t use ordinal numbers, but we also use simply <Day> <Month> instead of <Month> <Day><suffix>.

I’ve spent quite a bit of time looking for these date format strings under Personalize → Text Content but I’ve been unable to change the strings. Can someone guide me into the correct place to edit the format so it lists:

5 abril

Instead of:

abril 5º

Thank you.

3 curtidas

Good catch!

That is a bug in the plugin, where it isn’t using localized formats in many places

Looks like the built-in localized formats in Moment.js aren’t that great either, so we should use our own localized formats.

I suggest changing:

@@ -4,10 +4,11 @@ export default Ember.Controller.extend({
   @computed
   title() {
     const date = moment();
+    const dateFormat = I18n.t("dates.long_no_year_no_time");
 
     return I18n.t("anniversaries.upcoming.title", {
-      start_date: date.add(2, "days").format("MMMM Do"),
-      end_date: date.add(7, "days").format("MMMM Do")
+      start_date: date.add(2, "days").format(dateFormat),
+      end_date: date.add(7, "days").format(dateFormat)
     });
   },

What do you think @tgxworld ?

5 curtidas

Thank you for the help!

I have a similar complaint that occurs in one of the summary emails, would it be OK to add it to this topic or should I create a new one for it?

Another topic please.

1 curtida

Good catch @Falco. I’ve fixed it in

https://github.com/discourse/discourse-cakeday/commit/c85b67944843200d2221830d31d3fa99bd34ef66

Thanks to @plipsqueek for reporting this as well.

3 curtidas