Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish localising the DateEntry and Calendar #5571

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open

Conversation

andydotxyz
Copy link
Member

@andydotxyz andydotxyz commented Mar 2, 2025

Fixes #5141

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

@coveralls
Copy link

coveralls commented Mar 2, 2025

Coverage Status

coverage: 62.292% (+0.002%) from 62.29%
when pulling 617a3a8 on fix/5141
into 6b733a7 on develop.

@andydotxyz
Copy link
Member Author

Thanks for adding the Sunday starts - but I don't think they all use US date format ...

@dweymouth
Copy link
Contributor

Thanks for adding the Sunday starts - but I don't think they all use US date format ...

I have them using the day/month/year format?

@andydotxyz
Copy link
Member Author

So you do - I can't read sorry.

localeWeekStartKey = "locale.date.startweek"
)

var localeSettings = map[string]map[string]string{
Copy link
Member

@Jacalz Jacalz Mar 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a very memory inefficient data structure with quite a lot of duplicated data. Is there any way we can make this more efficient as languages grow?

One idea I have is to just use trucks and avoid the map inside map. It might also make sense to have the starting day as an index (maya be as an enum) and not a string to avoid duplicating that data a lot.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was included to be a replacement for the lan file lookups until a better solution was decided upon - you can see the suggestion from @dweymouth.

Yes there are many more efficient ways to pack this data in, but they would not work if we ever make this more configurable again through something like weblate. Optimising for storage in code seems premature with that in mind. Similarly using "0" to represent Sunday (or Monday) makes it hard to read if we move to such a file later.

Copy link
Member

@Jacalz Jacalz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you wish to add Swedish to the list then it is Monday and time.DateOnly that is correct.

@andydotxyz
Copy link
Member Author

If you wish to add Swedish to the list then it is Monday and time.DateOnly that is correct.

Thanks for this - but given that Swedish is the language do you mean Sweden? (i.e. (SE)?

This seems like a very memory inefficient data structure with quite a lot of duplicated data.

I have significantly reduced the memory requirement, hopefully this makes it good for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants