djangoproject.com icon indicating copy to clipboard operation
djangoproject.com copied to clipboard

feat: Translation preparation for blog app

Open marksweb opened this issue 1 year ago • 5 comments

This adds translations tags to the blog app as suggested in #1648

marksweb avatar Oct 15 '24 19:10 marksweb

@bmispelon Bit of scope creep at the 11th hour here, but I've added a formats file to allow us to customise the datetime formats.

With this, it'd be good to get this merged before others so that I can then start using named date formats on the other apps.

marksweb avatar Oct 16 '24 23:10 marksweb

I don't think adding custom formats works:

>>> from django.template.defaultfilters import date as datefilter
>>> from datetime import datetime
>>> datefilter(datetime.now(), "MONTH_DAY_YEAR_FORMAT")
'Oct-0500Oct.CDT09_ThuAM2024_2024OctoberAMR_October-0500ROctAMCDT'

And I'm not completely convinced about the idea of custom formats either. I get the feeling that having to maintaing a formats file for all the language we might support wouldn't be worth it, when the alternative is to use the existing DATE_FORMAT that Django ships with. Admitedly, it's not 100% the same output as what we had before (the month name is shortened), but I feel that's an acceptable tradeoff.

What do you think?

bmispelon avatar Oct 17 '24 14:10 bmispelon

I don't think adding custom formats works

Oh boy. Here's my first 🤦🏼 moment on this project. I convinced myself last night I was looking at the right pages to see that format.

So I guess that means you can only customise the format of pre-defined formats. I'll just select the most suitable format in each instance then.

marksweb avatar Oct 17 '24 15:10 marksweb

Here's hoping to many more 🤦🏻 moments, that just means we're doing exciting things 😁

I didn't know before reviewing your PRs that you could use named formats, so I'm happy to be learning new things.

bmispelon avatar Oct 17 '24 17:10 bmispelon

@marksweb Could you rebase this branch on the latest main and force-push it so it fixes the coveralls failure?

bmispelon avatar Oct 23 '24 12:10 bmispelon