Page MenuHomePhabricator

XHPast Parse error when extracting i18n
Closed, ResolvedPublic

Description

I was trying to do a ./bin/i18n extract from phabricator directory, in order to start a french traduction.
It struggled on a xhpast syntax error :

[...]
<<< [67] <exec> 58,560 us
>>> [69] <exec> $ '/var/www/phabricator/libphutil/src/parser/xhpast/bin/xhpast'
<<< [68] <exec> 395,709 us
>>> [70] <exec> $ '/var/www/phabricator/libphutil/src/parser/xhpast/bin/xhpast'
<<< [69] <exec> 354,959 us
>>> [71] <exec> $ '/var/www/phabricator/libphutil/src/parser/xhpast/bin/xhpast'
<<< [70] <exec> 12,987 us
>>> [72] <exec> $ '/var/www/phabricator/libphutil/src/parser/xhpast/bin/xhpast'
<<< [71] <exec> 11,476 us
>>> [73] <exec> $ '/var/www/phabricator/libphutil/src/parser/xhpast/bin/xhpast'
<<< [72] <exec> 11,853 us
>>> [74] <exec> $ '/var/www/phabricator/libphutil/src/parser/xhpast/bin/xhpast'
<<< [73] <exec> 10,839 us
>>> [75] <exec> $ '/var/www/phabricator/libphutil/src/parser/xhpast/bin/xhpast'
<<< [74] <exec> 55,447 us
>>> [76] <exec> $ '/var/www/phabricator/libphutil/src/parser/xhpast/bin/xhpast'
<<< [75] <exec> 57,626 us
>>> [77] <exec> $ '/var/www/phabricator/libphutil/src/parser/xhpast/bin/xhpast'
<<< [76] <exec> 12,482 us
>>> [78] <exec> $ '/var/www/phabricator/libphutil/src/parser/xhpast/bin/xhpast'
<<< [77] <exec> 8,975 us
>>> [79] <exec> $ '/var/www/phabricator/libphutil/src/parser/xhpast/bin/xhpast'
<<< [78] <exec> 9,291 us
<<< [79] <exec> 6,258 us
[2015-10-27 13:34:19] EXCEPTION: (XHPASTSyntaxErrorException) XHPAST Parse Error: syntax error, unexpected T_STRING on line 357 at [<phutil>/src/parser/xhpast/api/XHPASTTree.php:55]
arcanist(head=master, ref.master=3308da5f8fbe), phabricator(head=master, ref.master=cea633f698da), phutil(head=master, ref.master=d5b4421792e5)
  #0 XHPASTTree::newFromDataAndResolvedExecFuture(string, array) called at [<phabricator>/src/infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php:54]
  #1 PhabricatorInternationalizationManagementExtractWorkflow::execute(PhutilArgumentParser) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:406]
  #2 PhutilArgumentParser::parseWorkflowsFull(array) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:301]
  #3 PhutilArgumentParser::parseWorkflows(array) called at [<phabricator>/scripts/setup/manage_i18n.php:21]

Event Timeline

tycho.tatitscheff renamed this task from XHPast Parse error on XHPASTTree.php:55 to XHPast Parse error when etracting i18n.
tycho.tatitscheff updated the task description. (Show Details)
tycho.tatitscheff added a project: XHPAST.

This is because externals/stripe-php/lib/Stripe/ApiRequestor.php has this on line 357:

$url = "ssl://{$url["host"]}:{$port}";

See also T8049, probably.

epriestley triaged this task as Wishlist priority.Oct 27 2015, 4:47 PM

Is there any real news to extract translations from externals/?

Probably not, but it seems vaguely nice that i18n extract doesn't need to know anything about the directory structure, and that we can put pht() in externals/ as a local patch if we need to clarify some error or something.

If we wanted to move forward with this today I'd definitely just blacklist externals/ and move on, but I don't think i18n extract even produces usable output right now? Maybe I'm misremembering how far it got. But I think there's another brick wall right behind this one, so we don't get much by hacking around it.

joshuaspence renamed this task from XHPast Parse error when etracting i18n to XHPast Parse error when extracting i18n.Nov 12 2015, 10:20 AM

@ofbeaton, if you care also about starting a translation, you can do it for src/applications like this :
./bin/i18n extract src/applications and ./bin/i18n extract src/view and merge the results.

I think it cover a great part of webui interface, but not all. src/infrastructure and src/aphront does not contains alot of pht()stuff that normal user (not admin) can see...