Feature #7722

Implement CLDR data reader

Added by Karol Gusak about 5 years ago. Updated almost 5 years ago.

Status:Resolved Start date:
Priority:Must have Due date:
Assigned To:Karol Gusak % Done:

100%

Category:I18n
Target version:TYPO3 Flow Base Distribution - 1.0 alpha 11
PHP Version: Complexity:
Has patch:

Description

CLDR data contains information in XML format about many different aspects related to localization. FLOW3 18n / l10n subsystem will use following parts of this data:

  • Plural forms - what plural forms exists in a language (zero, one, few, many, other) and how quantity relates to them
  • Numbers - how to represent decimal numbers, big numbers etc
  • Currencies - how values are formatted
  • Date and time - short, medium and full formatting of dates and time

Parsing for all of these data types needs to be written separately, as they have not much in common (except all of them are represented in XML format).


Related issues

related to TYPO3.Flow - Feature #6724: Internationalization, locale, multi-language ect. Resolved

Associated revisions

Revision c55691f4
Added by Karol Gusak about 5 years ago

[+FEATURE] FLOW3 (Locale): Added fundamental classes for CLDR data reader. They will be used to build concrete readers. Relates to #7722.
[~TASK] FLOW3 (Locale): Moved the method responsible for generating available locales' list from Detector to Service class. Relates #7720.
[~TASK] FLOW3 (Locale): Minor code cleaning.

Revision eb13030d
Added by Karol Gusak about 5 years ago

[+FEATURE] FLOW3 (Locale): Added support for plurals rules from CLDR. Relates to #7722.
[~TASK] FLOW3 (Locale): Slightly changed CLDRRepository methods in order to automatically build absolute filenames from relative ones for CLDR files and directories. Relates to #7722.

Revision 36e79c52
Added by Karol Gusak about 5 years ago

[+FEATURE] FLOW3 (Locale): Added number formatting as defined in CLDR. Relates to #7722.
[+TASK] FLOW3 (Locale): Added support for iterating over results from HierarchicalCLDRModel. Relates to #7722.

Revision b01a439f
Added by Karol Gusak about 5 years ago

[+FEATURE] FLOW3 (Locale): Added date / time formatting as defind in CLDR. Relates to #7722.
[+FEATURE] FLOW3 (Locale): Added support for aliases in CLDR parser. Relates to #7722.
[~TASK] FLOW3 (Locale): Changed internal representation of CLDR data (it is simpler and more robust now). Relates #7722.
[~TASK] FLOW3 (Locale): Reimplemented CLDRModel classes (new methods for accessing data). Relates to #7722.

Revision ec92a3db
Added by Karol Gusak about 5 years ago

[+FEATURE] FLOW3 (Locale): Added date / time formatting as defind in CLDR (now included in commit). Relates to #7722.

Revision 79e9ccb0
Added by Karol Gusak about 5 years ago

[~TASK] FLOW3 (Locale): Renamed getOneElement() to getElement() in CldrModelInterface. Relates to #7722.
[~TASK] FLOW3 (Locale): Changed empty-string key with predefined constant used in CldrModel's parsed CLDR data array. Relates to #7722.
[~TASK] FLOW3 (Locale): Minor doc comments improvements.

Revision 7baee093
Added by Karol Gusak about 5 years ago

[+FEATURE] FLOW3 (Locale): Added support for XLIFF file format. Relates to #7723.
[+FEATURE] FLOW3 (Locale): Added TranslationProvider interface and concrete implementation using XLIFF. Relates to #7723.
[~TASK] FLOW3 (Locale): Changed class hierarchy for XML Models. Relates to #7722, #7723.
[~TASK] FLOW3 (Locale): Miscellaneous code cleaning.

Revision c1204c81
Added by Karol Gusak about 5 years ago

[~TASK] FLOW3 (I18n): Minor cleaning of variables' names.
[~TASK] FLOW3 (I18n): Changed Readers so they throw exceptions when unable to get format from CLDR. Relates to #7722.

Revision 419cba15
Added by Karol Gusak about 5 years ago

[~TASK] FLOW3 (I18n): Moved formatting functionality from DatesReader to DatetimeFormatter. Relates to #7722, 7724.

Revision 3a28df25
Added by Karol Gusak about 5 years ago

[~TASK] FLOW3 (I18n): Moved formatting functionality from NumbersReader to NumberFormatter. Relates to #7722, #7724.
[~TASK] FLOW3 (I18n): Minor code cleaning.

History

#1 Updated by Karol Gusak about 5 years ago

  • Status changed from New to Accepted
  • % Done changed from 0 to 30

Basic classes for CLDR are done. There is CLDRModel which represents data from one CLDR file, and HierarchicalCLDRModel which contains a number of related models. All is cached, so most of the time the CLDR files will not be even parsed. CLDRRepository is used to retrieve models.

A hierarchy implementation in HierarchicalCLDRModel is very simple but I think it will be sufficient (please see class description).

#2 Updated by Karol Gusak about 5 years ago

  • % Done changed from 30 to 60

PluralsReader and NumbersReader are done.

Parsing of plurals rules as in UTS 35 - Language Plural Rules
Parsing of number formats as in UTS 35 - Number Format Patterns

NumbersReader does not implement 100% of the specification. Some features are missing as they complicate things a lot. But most important syntax is supported.

BTW: Commit didn't show up on the tracker, I'm not sure why.

#3 Updated by Karol Gusak about 5 years ago

  • % Done changed from 60 to 90

DatesReader implemented.

Date and time format syntax: Date Format Patterns

DatesReader also doesn't implement 100% of specification, but most important part is supported. See the documentation for DatesReader class for details.

#4 Updated by Karol Gusak almost 5 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 90 to 100

After many minor and major rewrites the Reader classes look like I think they should ;-).

#5 Updated by Karsten Dambekalns almost 5 years ago

  • Target version set to 1.0 alpha 11

Also available in: Atom PDF