diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -572,7 +572,7 @@ return $this; } - public function getSex() { + public function getGender() { return $this->getUserSetting(PhabricatorPronounSetting::SETTINGKEY); } diff --git a/src/infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php b/src/infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php --- a/src/infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php +++ b/src/infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php @@ -175,10 +175,49 @@ try { $string_value = $string_node->evalStatic(); + $args = $params->getChildren(); + $args = array_slice($args, 1); + + $types = array(); + foreach ($args as $child) { + $type = null; + + switch ($child->getTypeName()) { + case 'n_FUNCTION_CALL': + $call = $child->getChildByIndex(0); + if ($call->getTypeName() == 'n_SYMBOL_NAME') { + switch ($call->getConcreteString()) { + case 'phutil_count': + $type = 'number'; + break; + case 'phutil_person': + $type = 'person'; + break; + } + } + break; + case 'n_NEW': + $class = $child->getChildByIndex(0); + if ($class->getTypeName() == 'n_CLASS_NAME') { + switch ($class->getConcreteString()) { + case 'PhutilNumber': + $type = 'number'; + break; + } + } + break; + default: + break; + } + + $types[] = $type; + } + $results[$hash][] = array( 'string' => $string_value, 'file' => Filesystem::readablePath($full_path, $root_path), 'line' => $string_line, + 'types' => $types, ); } catch (Exception $ex) { $messages[] = pht( @@ -207,10 +246,23 @@ $map = array(); foreach ($strings as $hash => $string_list) { foreach ($string_list as $string_info) { - $map[$string_info['string']]['uses'][] = array( + $string = $string_info['string']; + + $map[$string]['uses'][] = array( 'file' => $string_info['file'], 'line' => $string_info['line'], ); + + if (!isset($map[$string]['types'])) { + $map[$string]['types'] = $string_info['types']; + } else if ($map[$string]['types'] !== $string_info['types']) { + echo tsprintf( + "** %s ** %s\n", + pht('WARNING'), + pht( + 'Inferred types for string "%s" vary across callsites.', + $string_info['string'])); + } } }