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

Generator-API for CLDR-patterns of date and time #845

Open
MenoData opened this issue Dec 12, 2018 · 0 comments
Open

Generator-API for CLDR-patterns of date and time #845

MenoData opened this issue Dec 12, 2018 · 0 comments

Comments

@MenoData
Copy link
Owner

The CLDR-data have skeleton pattern entries which allow to generate patterns for date and time just based on locale, text width and a choice of "skeleton" identifiers (ruling which date-time-elements shall be used). Example from German data:

-<dateTimeFormats>


-<dateTimeFormatLength type="full">


-<dateTimeFormat>

<pattern>{1} 'um' {0}</pattern>

</dateTimeFormat>

</dateTimeFormatLength>


-<dateTimeFormatLength type="long">


-<dateTimeFormat>

<pattern>{1} 'um' {0}</pattern>

</dateTimeFormat>

</dateTimeFormatLength>


-<dateTimeFormatLength type="medium">


-<dateTimeFormat>

<pattern>{1}, {0}</pattern>

</dateTimeFormat>

</dateTimeFormatLength>


-<dateTimeFormatLength type="short">


-<dateTimeFormat>

<pattern>{1}, {0}</pattern>

</dateTimeFormat>

</dateTimeFormatLength>


-<availableFormats>

<dateFormatItem id="Bh">h B</dateFormatItem>

<dateFormatItem id="Bhm">h:mm B</dateFormatItem>

<dateFormatItem id="Bhms">h:mm:ss B</dateFormatItem>

<dateFormatItem id="d">d</dateFormatItem>

<dateFormatItem id="E">ccc</dateFormatItem>

<dateFormatItem id="EBhm">E h:mm B</dateFormatItem>

<dateFormatItem id="EBhms">E h:mm:ss B</dateFormatItem>

<dateFormatItem id="Ed">E, d.</dateFormatItem>

<dateFormatItem id="Ehm">E h:mm a</dateFormatItem>

<dateFormatItem id="EHm">E, HH:mm</dateFormatItem>

<dateFormatItem id="Ehms">E, h:mm:ss a</dateFormatItem>

<dateFormatItem id="EHms">E, HH:mm:ss</dateFormatItem>

<dateFormatItem id="Gy">y G</dateFormatItem>

<dateFormatItem id="GyMMM">MMM y G</dateFormatItem>

<dateFormatItem id="GyMMMd">d. MMM y G</dateFormatItem>

<dateFormatItem id="GyMMMEd">E, d. MMM y G</dateFormatItem>

<dateFormatItem id="h">h 'Uhr' a</dateFormatItem>

<dateFormatItem id="H">HH 'Uhr'</dateFormatItem>

<dateFormatItem id="hm">h:mm a</dateFormatItem>

<dateFormatItem id="Hm">HH:mm</dateFormatItem>

<dateFormatItem id="hms">h:mm:ss a</dateFormatItem>

<dateFormatItem id="Hms">HH:mm:ss</dateFormatItem>

The skeleton identifiers might be modelled as enums which look like DateSkeleton.YMD or TimeSkeleton.HMSA and can be used either just for date or time patterns or can be combined by and(...)-methods to form date-time-patterns using a generator-method like createPattern(Locale, TextWidth).

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

No branches or pull requests

1 participant