mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
Add translations config group.
Summary: Adds the translations group as per T2255. Currently `translation.override` is `wild` -- it should be changed to dict<string, string> when that exists. Also fixes a small bug from D4326 which caused "class" types to not ever validate. Test Plan: - Looked at the settings. - Successfully saved a setting relating to classes. Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2255 Differential Revision: https://secure.phabricator.com/D4350
This commit is contained in:
parent
3894461227
commit
ae0773b789
3 changed files with 46 additions and 1 deletions
|
@ -1217,6 +1217,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorTransactions' => 'applications/transactions/constants/PhabricatorTransactions.php',
|
'PhabricatorTransactions' => 'applications/transactions/constants/PhabricatorTransactions.php',
|
||||||
'PhabricatorTransformedFile' => 'applications/files/storage/PhabricatorTransformedFile.php',
|
'PhabricatorTransformedFile' => 'applications/files/storage/PhabricatorTransformedFile.php',
|
||||||
'PhabricatorTranslation' => 'infrastructure/internationalization/PhabricatorTranslation.php',
|
'PhabricatorTranslation' => 'infrastructure/internationalization/PhabricatorTranslation.php',
|
||||||
|
'PhabricatorTranslationsConfigOptions' => 'applications/config/option/PhabricatorTranslationsConfigOptions.php',
|
||||||
'PhabricatorTrivialTestCase' => 'infrastructure/testing/__tests__/PhabricatorTrivialTestCase.php',
|
'PhabricatorTrivialTestCase' => 'infrastructure/testing/__tests__/PhabricatorTrivialTestCase.php',
|
||||||
'PhabricatorTypeaheadCommonDatasourceController' => 'applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php',
|
'PhabricatorTypeaheadCommonDatasourceController' => 'applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php',
|
||||||
'PhabricatorTypeaheadDatasourceController' => 'applications/typeahead/controller/PhabricatorTypeaheadDatasourceController.php',
|
'PhabricatorTypeaheadDatasourceController' => 'applications/typeahead/controller/PhabricatorTypeaheadDatasourceController.php',
|
||||||
|
@ -2518,6 +2519,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorTimer' => 'PhabricatorCountdownDAO',
|
'PhabricatorTimer' => 'PhabricatorCountdownDAO',
|
||||||
'PhabricatorTransactionView' => 'AphrontView',
|
'PhabricatorTransactionView' => 'AphrontView',
|
||||||
'PhabricatorTransformedFile' => 'PhabricatorFileDAO',
|
'PhabricatorTransformedFile' => 'PhabricatorFileDAO',
|
||||||
|
'PhabricatorTranslationsConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||||
'PhabricatorTrivialTestCase' => 'PhabricatorTestCase',
|
'PhabricatorTrivialTestCase' => 'PhabricatorTestCase',
|
||||||
'PhabricatorTypeaheadCommonDatasourceController' => 'PhabricatorTypeaheadDatasourceController',
|
'PhabricatorTypeaheadCommonDatasourceController' => 'PhabricatorTypeaheadDatasourceController',
|
||||||
'PhabricatorTypeaheadDatasourceController' => 'PhabricatorController',
|
'PhabricatorTypeaheadDatasourceController' => 'PhabricatorController',
|
||||||
|
|
|
@ -361,7 +361,7 @@ final class PhabricatorConfigEditController
|
||||||
->setConcreteOnly(true)
|
->setConcreteOnly(true)
|
||||||
->selectSymbolsWithoutLoading();
|
->selectSymbolsWithoutLoading();
|
||||||
$names = ipull($symbols, 'name', 'name');
|
$names = ipull($symbols, 'name', 'name');
|
||||||
sort($names);
|
asort($names);
|
||||||
$names = array(
|
$names = array(
|
||||||
'' => pht('(Use Default)'),
|
'' => pht('(Use Default)'),
|
||||||
) + $names;
|
) + $names;
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorTranslationsConfigOptions
|
||||||
|
extends PhabricatorApplicationConfigOptions {
|
||||||
|
|
||||||
|
public function getName() {
|
||||||
|
return pht("Translations");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription() {
|
||||||
|
return pht("Options relating to translations.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOptions() {
|
||||||
|
return array(
|
||||||
|
$this->newOption(
|
||||||
|
'translation.provider',
|
||||||
|
'class',
|
||||||
|
'PhabricatorEnglishTranslation')
|
||||||
|
->setBaseClass('PhabricatorTranslation')
|
||||||
|
->setSummary(pht("Translation class that should be used for strings."))
|
||||||
|
->setDescription(
|
||||||
|
pht(
|
||||||
|
"This allows customizing texts used in Phabricator. The class ".
|
||||||
|
"must extend PhabricatorTranslation."))
|
||||||
|
->addExample('PhabricatorEnglishTranslation', pht('Valid Setting')),
|
||||||
|
// TODO: This should be dict<string,string> I think, but that doesn't
|
||||||
|
// exist yet.
|
||||||
|
$this->newOption('translation.override', 'wild', array())
|
||||||
|
->setSummary(pht("Override translations."))
|
||||||
|
->setDescription(
|
||||||
|
pht(
|
||||||
|
"You can use 'translation.override' if you don't want to create ".
|
||||||
|
"a full translation to give users an option for switching to it ".
|
||||||
|
"and you just want to override some strings in the default ".
|
||||||
|
"translation."))
|
||||||
|
->addExample(
|
||||||
|
'{"some string": "my alternative"}',
|
||||||
|
pht('Valid Setting')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue