The motivation for this was to allow module developers to change what parser is used to parse SilverStripe templates.
This change enables people to compile their own version of the SilverStripe template parser and use it without modifying core files.
This is a necessity for any further 3.1 pushes of master files to getlocalization.
Because we'd otherwise remove existing master strings for CTF etc,
which means we can no longer backport new translations to 3.0
(and there's no way for users to contribute translations to 3.0 via getlocalization).
It's still a very monolithic class, but at least I've refactored it to return
all collected strings without writing it to files (for easier testing).
API Added Convert::nl2os function to normalise end of line characters across systems with tests
BUG Fixed i18n unit tests in non-unix systems constantly failing
BUG Fixed problems with HTMLCleaner tests failing in non-unix systems
Avoids breaking execution if PHPUnit is not installed,
since classes in framework/dev/ extend PHPUnit,
and get autoloaded when we inspect the ancestry and implementors
of every class defined on the filesystem.
Not an ideal, since it removes i18n support for dev classes,
but in practice this only impacts a single entity definition.
The entire framework repo (with the exception of system-generated files) has been amended to respect the 120c line-length limit. This is in preparation for the enforcement of this rule with PHP_CodeSniffer.
The collector didn't find classes marked as entity providers
unless they were already loaded as a sideeffect of the preceding
execution path. Since we want to introspect the whole codebase,
autoloading is mandatory here.
i18nTextCollector takes an argument to restrict text collection to specific modules.
This used to restrict by limiting the modules scanned by the text collector. But
modules can actually provide translations for other modules (see for e.g.
CMSMenu#provideI18nEntities)
This patch changes the text collector to scan all modules, and then apply the restriction
to the output
ENHANCEMENT Refactored i18nTextCollector collection logic alongside $priority removal, from regex to (slightly more maintainable) PHP tokenizer. Using var_export() for generating PHP, which auto-escapes strings more robustly.
ENHANCEMENT Refactored i18nTextCollector into pluggable writers (in preparation of new YML output format)