Page MenuHomePhabricator
Paste P1821

src/infrastructure/internationalization/translation/PhabricatorPlainEnglishTranslation.php
ActivePublic

Authored by devurandom on Jul 10 2015, 9:28 AM.
<?php
final class PhabricatorPlainEnglishTranslation
extends PhutilTranslation {
public function getLocaleCode() {
return 'en_P*';
}
protected function getTranslations() {
return array(
'Diffusion' => 'Repositories',
'Host and Browse Repositories' => 'Diffusion',
'Differential' => 'Review Code',
'Review Code' => 'Differential',
'Maniphest' => 'Tasks and Bugs',
'Tasks and Bugs' => 'Maniphest',
'Phame' => 'Blog',
'Blog' => 'Phame',
'Phriction' => 'Wiki',
'Wiki' => 'Phriction',
);
}
}

Event Timeline

devurandom changed the title of this paste from untitled to src/infrastructure/internationalization/translation/PhabricatorPlainEnglishTranslation.php.
devurandom updated the paste's language from autodetect to autodetect.

Also needs following patch to libphutil:

diff --git a/src/internationalization/PhutilTranslator.php b/src/internationalization/PhutilTranslator.php
index b30823b..dfd4706 100644
--- a/src/internationalization/PhutilTranslator.php
+++ b/src/internationalization/PhutilTranslator.php
@@ -136,6 +136,7 @@ final class PhutilTranslator extends Phobject {
       case 'en_W*':
       case 'en_R*':
       case 'en_A*':
+      case 'en_P*':
         list($singular, $plural) = $translations;
         if ($variant == 1) {
           return $singular;

And the locale file src/internationalization/locales/PhutilPlainEnglishLocale.php (also in libphutil):

<?php

/**
 * Pain English, no Phabisms
 */
final class PhutilPlainEnglishLocale extends PhutilLocale {

  public function getLocaleCode() {
    return 'en_P*';
  }

  public function getLocaleName() {
    return pht('English (Plain)');
  }

  public function getFallbackLocaleCode() {
    return 'en_US';
  }

}

The default language can be changed using following patch (cf. T8916):

diff --git a/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php b/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php
index 72a2252..b233ba0 100644
--- a/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php
@@ -72,7 +72,7 @@ final class PhabricatorAccountSettingsPanel extends PhabricatorSettingsPanel {
 
     asort($translations);
     // TODO: Implement "locale.default" and use it here.
-    $default = 'en_US';
+    $default = 'en_P*';
     $translations = array(
       '' => pht('Server Default: %s', $locales[$default]->getLocaleName()),
     ) + $translations;
diff --git a/src/infrastructure/env/PhabricatorEnv.php b/src/infrastructure/env/PhabricatorEnv.php
index d5c4c34..3c09d0b 100644
--- a/src/infrastructure/env/PhabricatorEnv.php
+++ b/src/infrastructure/env/PhabricatorEnv.php
@@ -126,7 +126,7 @@ final class PhabricatorEnv extends Phobject {
 
     // TODO: Add a "locale.default" config option once we have some reasonable
     // defaults which aren't silly nonsense.
-    self::setLocaleCode('en_US');
+    self::setLocaleCode('en_P*');
   }
 
   public static function beginScopedLocale($locale_code) {

The default language can be changed using following patch (cf. T8916):

diff --git a/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php b/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php
index 72a2252..b233ba0 100644
--- a/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorAccountSettingsPanel.php
@@ -72,7 +72,7 @@ final class PhabricatorAccountSettingsPanel extends PhabricatorSettingsPanel {
 
     asort($translations);
     // TODO: Implement "locale.default" and use it here.
-    $default = 'en_US';
+    $default = 'en_P*';
     $translations = array(
       '' => pht('Server Default: %s', $locales[$default]->getLocaleName()),
     ) + $translations;
diff --git a/src/infrastructure/env/PhabricatorEnv.php b/src/infrastructure/env/PhabricatorEnv.php
index d5c4c34..3c09d0b 100644
--- a/src/infrastructure/env/PhabricatorEnv.php
+++ b/src/infrastructure/env/PhabricatorEnv.php
@@ -126,7 +126,7 @@ final class PhabricatorEnv extends Phobject {
 
     // TODO: Add a "locale.default" config option once we have some reasonable
     // defaults which aren't silly nonsense.
-    self::setLocaleCode('en_US');
+    self::setLocaleCode('en_P*');
   }
 
   public static function beginScopedLocale($locale_code) {

This is not working for me - The first part of the code to patch ($default..) is not existing in my PhabricatorAccountSettingsPanel.php.
The only content of the file in my case is:

<?php

final class PhabricatorAccountSettingsPanel
  extends PhabricatorEditEngineSettingsPanel {

  const PANELKEY = 'account';

  public function getPanelName() {
    return pht('Account');
  }

  public function getPanelGroupKey() {
    return PhabricatorSettingsAccountPanelGroup::PANELGROUPKEY;
  }

  public function isManagementPanel() {
    return true;
  }

  public function isTemplatePanel() {
    return true;
  }

}