Applied this simple hack to `phabricator/`:
```lang=diff
diff --git a/src/infrastructure/env/PhabricatorEnv.php b/src/infrastructure/env/PhabricatorEnv.php
index 31fd116..9e08a21 100644
--- a/src/infrastructure/env/PhabricatorEnv.php
+++ b/src/infrastructure/env/PhabricatorEnv.php
@@ -59,6 +59,8 @@ final class PhabricatorEnv extends Phobject {
private static $readOnly;
private static $readOnlyReason;
+ public static $frequency = array();
+
const READONLY_CONFIG = 'config';
const READONLY_UNREACHABLE = 'unreachable';
const READONLY_SEVERED = 'severed';
@@ -166,7 +168,8 @@ final class PhabricatorEnv extends Phobject {
PhutilTranslator::getInstance()
->setLocale($locale)
- ->setTranslations($override + $translations);
+ ->setTranslations($override + $translations)
+ ->setWillTranslateCallback('PhabricatorEnv::willTranslate');
self::$localeCode = $locale_code;
} catch (Exception $ex) {
@@ -174,6 +177,13 @@ final class PhabricatorEnv extends Phobject {
}
}
+ public static function willTranslate($text) {
+ if (empty(self::$frequency[$text])) {
+ self::$frequency[$text] = 0;
+ }
+ self::$frequency[$text]++;
+ }
+
private static function buildConfigurationSourceStack($config_optional) {
self::dropConfigCache();
diff --git a/webroot/index.php b/webroot/index.php
index 59e5b71..d57dd35 100644
--- a/webroot/index.php
+++ b/webroot/index.php
@@ -15,6 +15,14 @@ try {
try {
PhabricatorStartup::beginStartupPhase('run');
AphrontApplicationConfiguration::runHTTPRequest($sink);
+
+ $freq = PhabricatorEnv::$frequency;
+ asort($freq);
+ Filesystem::writeFile(
+ '/tmp/pht_frequency.json',
+ id(new PhutilJSON())
+ ->encodeFormatted($freq));
+
} catch (Exception $ex) {
try {
$response = new AphrontUnhandledExceptionResponse();
```
Got a datafile like this:
```lang=json
{
"Piece of Eight": 1,
"Haypence": 1,
"Disable DarkConsole": 1,
"Yellow Medal": 1,
"Doubloon": 1,
"Mountain of Wealth": 1,
"Baby Tequila": 1,
"Evil Spooky Haunted Tree": 1,
"Pterodactyl": 1,
...
```