Page MenuHomePhorge

Make Datepicker translatable
ClosedPublic

Authored by Leon95 on Jul 29 2021, 10:18.

Details

Reviewers
speck
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rPb293e6ffed0d: Make Datepicker translatable
Summary

This adds the Ablillity to translate the Content of the Date Picker. It is possible to display more than one Letter for the Day Captions.

Test Plan
  • Change the Language in the User Preferences, make sure it translates 'S|M|T|W|T|F|S' and Months or add the following to the translation.override config to get German Translation:
{
    'S|M|T|W|T|F|S': 'So|Mo|Di|Mi|Do|Fr|Sa',
    'January': 'Januar',
    'February': 'Februar',
    'March': 'März',
    'May': 'Mai',
    'June': 'Juni',
    'July': 'Juli',
    'October': 'Oktober',
    'December': 'Dezember'
}
  • Open Datepicker on a Datefield (Edit Event or Edit for Custom Field of Type date)
  • The Day Headers and the Months should now be translated

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Owners added a reviewer: Restricted Owners Package.Jul 29 2021, 10:18
  • Add Support for more than one Letter for Captions of Days
Leon95 edited the test plan for this revision. (Show Details)
Leon95 published this revision for review.EditedAug 26 2021, 17:26

I think it is complete for Review. But: What ist the Plan for new Features? Or Plans for Prototype Applications? I see they are disabled in this install and there is no Calendar Project. If the Priority is to get Phorge rebrand and related Things done first, this diff can safely lay around until Things are sorted.

0 added inline comments.
webroot/rsrc/js/core/behavior-fancy-datepicker.js
338

This assumes that all the day abbreviations will be the same length. Would it be cleaner to use strings like "S|M|T|W|T|F|S" and "So|Mo|Di|Mi|Do|Fr|Sa" instead, which are easily split into an array? That way there's no need to do any manual substring extraction.

CSharp added inline comments.
webroot/rsrc/js/core/behavior-fancy-datepicker.js
338

This seems like a much saner approach to me too. This would also allow for strings with different lengths, which could be interesting for disambiguation. Something like this "S|M|T|W|TH|F|S" if wanted.

It seems that across the Phorge repo there's no other scenario in which this is use, so it should have no side effects. So this would be setting a precedent for changes to follow.

speck requested changes to this revision.Sep 4 2021, 17:56
speck added inline comments.
webroot/rsrc/js/core/behavior-fancy-datepicker.js
338

@Leon95 if this also makes sense to you would you be able to take a look at updating the day-of-week string to be delimited?

This revision now requires changes to proceed.Sep 4 2021, 17:56
Leon95 planned changes to this revision.Sep 4 2021, 23:29
Leon95 added inline comments.
webroot/rsrc/js/core/behavior-fancy-datepicker.js
338

Will take a look at it

Leon95 edited the summary of this revision. (Show Details)
  • Merge branch 'master' into arcpatch-D25016
  • Use Pipesymbol for splitting Day Abbreviation String
Leon95 marked 3 inline comments as done.Sep 10 2021, 11:11
webroot/rsrc/js/core/behavior-fancy-datepicker.js
337

This should be able to use weekdays.length again

webroot/rsrc/js/core/behavior-fancy-datepicker.js
337

Yes, but only for readabillity. Providing Stings wich do not split into 7 Parts will produce garbage anyways.

Leon95 marked an inline comment as done.Sep 10 2021, 22:20

Thank you! This looks good and the translation stuff you used here answers some questions for me about how to get translated text into the front-end, something that has come up in D25015. I'll try to get this landed shortly.

This revision is now accepted and ready to land.Sep 12 2021, 23:56
This revision was automatically updated to reflect the committed changes.

Thanks for submitting this update!