Changeset View
Standalone View
src/applications/config/custom/PhabricatorCustomLogoConfigType.php
<?php | <?php | ||||
final class PhabricatorCustomLogoConfigType | final class PhabricatorCustomLogoConfigType | ||||
extends PhabricatorConfigOptionType { | extends PhabricatorConfigOptionType { | ||||
public static function getLogoImagePHID() { | public static function getLogoImagePHID() { | ||||
$logo = PhabricatorEnv::getEnvConfig('ui.logo'); | $logo = PhabricatorEnv::getEnvConfig('ui.logo'); | ||||
return idx($logo, 'logoImagePHID'); | return idx($logo, 'logoImagePHID'); | ||||
} | } | ||||
public static function getLogoWordmark() { | public static function getLogoWordmark() { | ||||
$logo = PhabricatorEnv::getEnvConfig('ui.logo'); | $logo = PhabricatorEnv::getEnvConfig('ui.logo'); | ||||
return idx($logo, 'wordmarkText'); | return idx($logo, 'wordmarkText'); | ||||
} | } | ||||
public static function getDefaultWordmark() { | |||||
return PhabricatorPlatformSite::getName(); | |||||
deadalnix: I know this is done in various places, but I don't really think it make sense to translate the… | |||||
Not Done Inline ActionsYeah, a non-literal will not work in pht. avivey: Yeah, a non-literal will not work in pht. | |||||
Done Inline ActionsI was afraid of that. Is the only route to review all externalized text and re-word it to not mention the product name? That might not be possible in all cases speck: I was afraid of that. Is the only route to review all externalized text and re-word it to not… | |||||
Not Done Inline ActionsI think the idiom is something like pht("%s", Foo::BAR); Pretty much untranslatable, but there's qqq and also it's probably not translated anyway. avivey: I think the idiom is something like
```
pht("%s", Foo::BAR);
```
Pretty much untranslatable… | |||||
Done Inline Actions
Okay that's the approach I've taken in other parts (e.g. PhabricatorPhabricatorAuthProvider and PhabricatorMailEmailEngine. Here I was just trying to simplify that in both places this method is called it's equivalent to what it was before (see line 111 below). I'll probably remove this method and swap out the two callers with pht('%s', PhabricatorApplication::PROJECT_APPLICATION_NAME) speck: > I think the idiom is something like
> ```
> pht("%s", Foo::BAR);
> ```
Okay that's the… | |||||
Not Done Inline ActionsNot at all! The proper way is to inject the product name as a parameter. Something like: pht('Your %s account has been successfully created!', getProductName()); You want to translate sentences, but you don't really want to translate the product name itself. Phorge is going to be called phorge in English, French, Spanish or Greek. deadalnix: Not at all! The proper way is to inject the product name as a parameter. Something like… | |||||
} | |||||
public function validateOption(PhabricatorConfigOption $option, $value) { | public function validateOption(PhabricatorConfigOption $option, $value) { | ||||
if (!is_array($value)) { | if (!is_array($value)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Logo configuration is not valid: value must be a dictionary.')); | 'Logo configuration is not valid: value must be a dictionary.')); | ||||
} | } | ||||
PhutilTypeSpec::checkMap( | PhutilTypeSpec::checkMap( | ||||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | if ($logo_image_phid) { | ||||
'removeLogo', | 'removeLogo', | ||||
1, | 1, | ||||
pht('Remove Custom Logo')); | pht('Remove Custom Logo')); | ||||
} | } | ||||
$controls[] = id(new AphrontFormTextControl()) | $controls[] = id(new AphrontFormTextControl()) | ||||
->setName('wordmarkText') | ->setName('wordmarkText') | ||||
->setLabel(pht('Wordmark')) | ->setLabel(pht('Wordmark')) | ||||
->setPlaceholder(pht('Phabricator')) | ->setPlaceholder(pht('%s', self::getDefaultWordmark())) | ||||
->setValue($wordmark_text); | ->setValue($wordmark_text); | ||||
return $controls; | return $controls; | ||||
} | } | ||||
} | } |
I know this is done in various places, but I don't really think it make sense to translate the project name.
In addition, most translation tool have a pass to extract strings from the codebase, and so passing variables (or constant for that matter) in them breaks.