Commit Graph

57 Commits

Author SHA1 Message Date
Hamish Friedlander
b25b45aab4 BUG Fix i18nTextCollector restriction to specific modules
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
2012-07-25 11:39:39 +12:00
Ingo Schommer
498a3fdf49 BUG Fixed i18n text collection in templates
- Non-greedy regex matching to collect more than
one entity per template...
- Regex failed to collect sprintf() properly
2012-07-18 14:58:53 +02:00
Ingo Schommer
2bd9852ae9 Fixed spelling of "Maori" in lang selection 2012-07-16 11:21:05 +02:00
Ingo Schommer
712f28bc78 Scoped deprecation messages (fixes #7645) 2012-07-13 11:37:35 +02:00
Ingo Schommer
3a7128d00c MINOR Fixed phpdocs 2012-06-20 23:59:16 +02:00
Ingo Schommer
acfc658b4e BUGFIX Fail silently in _t() legacy mode when using sprintf(), to avoid outdated translations breaking with a fatal error (e.g. CMSMain.ACCESS changed from two to one usage of {title}, which isn't changed yet in most languages). Slight performance overhead, but acceptable since its legacy usage only 2012-06-04 11:40:55 +02:00
Sam Minnee
db79739023 BUGFIX: Fixed inconsistencies in en vs. en_US handling in i18n 2012-05-28 14:10:58 +12:00
Sean Harvey
77dbceee35 BUGFIX i18n::include_by_locale() doesn't include a fallback language, _t() instead will include the language if it's not available.
This fixes en_GB translations not being picked up. i18n::get_translators() will always have a fallback of "en" language without the
region, and "en_US" as the locale.
2012-05-23 11:48:37 +12:00
Russell Michell
88a222fff3 MINOR: Updated inline phpdoc while investigating trac/4113 2012-05-18 18:00:03 +12:00
Ingo Schommer
f7e19ca680 BUGFIX i18nTextCollector finds templates recursively, not only in <module>/templates folder. Added master language entities which were previously overlooked due to this bug. 2012-05-03 17:45:25 +02:00
Ingo Schommer
431b9589b6 BUGFIX Fixed arguments in global _t() function, added check for $returnValue fallback that its not the injection array as second parameter 2012-05-01 22:17:01 +02:00
Ingo Schommer
0597e914ff MINOR Don't fail text collection for modules without any matching PHP files (only _config.php) 2012-05-01 22:17:01 +02:00
Ingo Schommer
e949b6f2b0 ENHANCEMENT Backwards compatible $priority parameter for i18n::_t(): Allow numeric arrays as parameters, as well as %s style replacements with a named parameter map (easier transition to new system with existing translation strings) 2012-05-01 22:17:00 +02:00
Ingo Schommer
f47cf33d71 MINOR Fixed i18nTextCollector module disambiguation, was looking at wrong array key (shifted one due to removed priority setting) 2012-04-27 10:11:38 +02:00
Ingo Schommer
98c2517b80 MINOR Fixed i18n:;get_owner_module(), broken by changed manifest returns (paths with leading slash) 2012-04-27 10:11:06 +02:00
Andrew O'Neil
a37370343e BUGFIX: Fix ?flush=1 not flushing en_US language 2012-04-23 14:51:12 +12:00
Ingo Schommer
a44916dc19 API CHANGE Don't use $tinymce_lang lookup in i18n::get_lang_from_locale(), as it mixes locales with langs and hence breaks language fallbacks in _t() (e.g. "pt_BR" returns "pt_br", rather than "pt") 2012-04-18 13:20:23 +02:00
Ingo Schommer
c2797f3ffa Merge pull request #342 from silverstripe-big-o/sapphire
---

This is the new _t syntax. All i18n unit tests pass.
2012-04-18 10:16:23 +02:00
Ingo Schommer
f8719e56a1 Merge pull request #337 from sminnee/fix-4911
BUGFIX: Fixed inconsistency in common_languages reference to Portuguese ...
2012-04-18 00:36:14 -07:00
Julian Seidenberg
7710cf59c7 MINOR: updating the documentation 2012-04-18 18:14:03 +12:00
Julian Seidenberg
90ae0ed18d BUGFIX: reverting back to Ingo's text collector from code, but using the parser to get from templates. Adding special case for _t functions in code that have an array in them. Fixing unit tests for all this. 2012-04-18 17:35:32 +12:00
Julian Seidenberg
0da62b9552 BUGFIX: fixing i18n _t function breaking out of when correct translation found 2012-04-18 17:35:32 +12:00
Julian Seidenberg
65e3651ff4 API-CHANGE: new translatable syntax _t function 2012-04-18 17:35:31 +12:00
Julian Seidenberg
c314d0b659 API-CHANGE: i18nTextCollector can now extract the new translatable entities (<%t) from templates and populate them in language tables (uses PEG parser) 2012-04-18 17:35:30 +12:00
Andrew O'Neil
fb3b03f38b MINOR: Remove support for PHP <5.3.2 2012-04-18 11:01:03 +12:00
Sam Minnee
5e5c5defa2 BUGFIX: Fixed inconsistency in common_languages reference to Portuguese (#4911) 2012-04-18 11:00:38 +12:00
Sam Minnee
cc7a012139 BUGFIX: Use the copy of symfony-yaml bundled with Zend_Translate to prevent class conflicts. Remove now-unnecessary symonfy-yaml thirdparty lib. 2012-04-18 09:34:57 +12:00
Ingo Schommer
7ce1572d38 MINOR Stability fixes on new tokenizer implementation of i18nTextCollector, allowing to specify writer and locale arguments on task execution 2012-04-16 12:25:49 +02:00
Sean Harvey
6ca7294c65 BUGFIX Fixed broken path, should be RailsYAML not RailsYaml 2012-04-16 14:04:41 +12:00
Ingo Schommer
6e13512200 MINOR Fixed up some language mappings in i18n (slightly different locales exported from getlocalization.com) 2012-04-15 20:54:24 +02:00
Ingo Schommer
c649fa3acf MINOR Workaround for duplicate require_once calls of same class in two locations (SS core and Zend_Translate_RailsYAML) 2012-04-15 18:46:04 +02:00
Ingo Schommer
d3b63dae0c MINOR Allowing to flush translation cache through ?flush=1 2012-04-15 18:46:04 +02:00
Ingo Schommer
d57e864110 MINOR Fixed tests related to i18nLegacyAdapter changes 2012-04-15 18:46:02 +02:00
Ingo Schommer
cbcee57496 ENHANCEMENT New i18nTextCollector_Writer_RailsYaml 2012-04-15 18:08:59 +02:00
Ingo Schommer
fca2c205b7 API CHANGE Removed $priority arguments from _t(), use module priorities instead.
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)
2012-04-15 17:17:17 +02:00
Ingo Schommer
d44f6b3e1f MINOR Removed deprecated usage of $priority argument in _t() calls 2012-04-15 17:17:17 +02:00
Ingo Schommer
3002598a5e MINOR Hardcoding correct module priorities in i18n.php 2012-04-15 17:17:16 +02:00
Ingo Schommer
95cdbe9d2c MINOR Avoid duplicate var declaration in i18n::_t() 2012-04-15 17:17:16 +02:00
Ingo Schommer
27ec83ce40 MINOR i18n::_t() getter performance optimisation (saves 10% on default CMS execution!) 2012-04-15 17:17:16 +02:00
Ingo Schommer
03de6e5e5f MINOR Removed i18nSSLegacyTranslator from default setup for performance reasons, document how to re-apply it 2012-04-15 17:17:16 +02:00
Ingo Schommer
652f0ec007 MINOR Infinite cache 2012-04-15 17:17:16 +02:00
Ingo Schommer
796975f53b MINOR Don't set locale on adapter in i18n::_t() for performance reasons, we're passing it with each individual translate() call anyway 2012-04-15 17:17:16 +02:00
Ingo Schommer
190c758639 MINOR Reverting to use directory scanning rather than Zend_Translate() in i18n::get_existing_languages(), as the only way to determine this information from Zend is loading all locales (which is way too slow e.g. for loading a language drop down in the member profile) 2012-04-15 17:17:15 +02:00
Ingo Schommer
326ff4a783 MINOR Added array fallback support to i18nSSLegacyAdapter 2012-04-15 17:17:15 +02:00
Ingo Schommer
0e0e5dd07a BUGFIX Ensuring that every locale (and its lang part) are registered as languages in i18n::include_by_locale() to avoid expensive re-parsing on subsequent i18n::_t() calls to the same locale 2012-04-15 17:17:15 +02:00
Ingo Schommer
bd23a07bba API CHANGE Using Zend_Translate with YAML translation files, replacing the $lang global and PHP files in the /lang folders. 2012-04-15 17:17:15 +02:00
Simon Welsh
f07258f3cf MINOR Update @package values to match renaming sapphire 2012-04-15 10:50:19 +12:00
Simon Welsh
3a6341a251 API-CHANGE sapphire folder can now be renamed. 2012-04-15 10:50:19 +12:00
Sam Minnee
767aef9794 BUGFIX: Don't call strpos() with an empty delimiter, mb_strpos() is more strict about this (#6751) 2012-03-24 11:14:20 +13:00
Simon Elvery
ac8a05f188 BUG FIX: Make sure the translation function doesn't try to include missing locale files over and over again. 2012-03-21 12:47:22 +10:00