Allow PhutilTranslator::translate() to return defaults
Details
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers - Maniphest Tasks
- T6845: Allow translator to return the base string if no translation is available
- Commits
- Restricted Diffusion Commit
rP19845395d887: Allow PhutilTranslator::translate() to return defaults - Required Signatures
L28 Phacility Individual Contributor License Agreement
Just check some strings returned correctly.
Diff Detail
Diff Detail
- Repository
- rPHU libphutil
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 3457 Build 3464: [Placeholder Plan] Wait for 30 Seconds
Event Timeline
Comment Actions
This behaves incorrectly for the translation "0", and I think this filtering should just occur in the translation provider itself. See T6845.
Comment Actions
Reworked this a bit. This method allows to make translation backword compatible and only filter keys with NULL value. The clean() would be overwritten from translation class to define own cleaner function.
This comment was removed by Zolli.
Comment Actions
Some minor inlines, I'll just fix these in the pull. Thanks!
src/infrastructure/internationalization/translation/PhabricatorTranslation.php | ||
---|---|---|
10 | "cleand" -> "cleaned" For consistency, use full sentences with periods in documentation: - Return the cleand translation array + Return the cleaned translation array. ^ ^ | |
14 | For consistency with getTranslations(), let's call this getCleanTranslations() (i.e., "translations", not "translation"). | |
25 | Use an array typehint, since this parameter must always be an array. | |
28–32 | Braces aren't aligned. |