Repository navigation
dev/core#2396 Towards Afform ts-less translations - #18
Conversation
8c3b81d to
a672009
Compare
|
@mlutfy I've rebased and fixed some conflicts on Additionally, I believe that the parser on the afform side evolved after this draft was introduced. It seems like the easiest thing is... to copy in the afform utility ( Pushed all that up. But there are still some oddities. If you do |
|
@totten So we built out a bunch of code for FormBuilder to basically parse this for translations. Are we able to call that parsing code instead of rebuilding it here or this needs to be independent? If so, I might upgrade @mlutfy code to basically use what we setup or copy/paste the same processing in his code. |
|
This would probably be overkill in the short-term: I suspect it would be best if the extraction code was in a PHP library, and then civistrings / civicrm would use that. Since it's not a ton of code, maybe it's not worth it, and we can just copy-paste for now? Although I see the original post had mentions of xpaths, so perhaps that part is version-dependent. @shaneonabike Can you point me to the core code, or update this PR (if you have permissions)? |
|
Perso I agree that calling it is better for maintenance reasons. We are surely going to add more and each time we would need to backport which would be a pain. The PR is https://github.com/civicrm/civicrm-core/pull/32859/files The String parser (helper function) is found in |
|
@mlutfy happy to help OR modify this but I would need to know what the best practices are for basically calling Civi functions (if there are any) |
There are always multiple ways to solve a problem. :) Using the live copy from
Another possible middle-ground is for
This requires some discipline in the maintenance of |
|
@totten I like your download method. Presently, it is pretty self-contained and perhaps after setting it up here we add a comment in Is that an avenue you think is reasonable to explore then? I can see what I can do to make that happen perhaps |
|
@shaneonabike Yep, I think that's a good avenue. |
|
@totten I added StringVisitor.php in composer.json. It seems to work (I deleted the original PHP file). Does this do anything? (I expected it to fail) |
|
@mlutfy Ah, yeah, you can just delete the For explanation, it's a bit like this:
|
| } | ||
| ], | ||
| "downloads": { | ||
| "mixlib": { |
There was a problem hiding this comment.
This line gives a name for the download task. Since you're downloading StringVisitor.php (not Mixlib.php), I'd suggest a name like:
| "mixlib": { | |
| "StringVisitor": { |
a20e513 to
2f1b38a
Compare
|
@totten Thanks! I implemented the changes you suggested. |
|
I'm wondering if there's any reason not merge? I guess we should run phpunit again. With this branch, I'm seeing a regression in processing (Aside: On the |
|
Took me a while to see it, but it extracts strings such as: i.e. with the |
2f1b38a to
8ef709a
Compare
|
I merged some changes into |
Probably best to fix the This is an attempt at this -> civicrm/civicrm-core#34303 |
|
jenkins retest this please |
|
I updated StringVisitor, but it's now failing with: |
|
@totten could you help out with the issue above? ^^ |
|
@mlutfy this needs a rebase |
|
@mlutfy what is the status here - I see another PR says it's waiting on this but this is looking stalled |
Co-authored-by: Tim Otten <totten@civicrm.org>
StringVisitor 6.11 takes ($doc, $callback); passing $form first made every .html file fail with "Call to a member function find() on array".
6281069 to
20f75e0
Compare
|
@mlutfy @eileenmcnaughton @shaneonabike @samuelsov I rebased and fixed the stringVisitor issue (with a little help from claude) |
|
@mattwire just reading this comment "which I suspect we will not be able to parse with phpQuery?" phpQuery isn't maintained - I did look at what replacing it with a few functions in core might look like |
|
@colemanw you have a PR that depends on this - is this (& by extension your PR) mergeable now? |
Adds basic support for translating any
af-textelement in Afform. Tests included, but only one of the test cases have been implemented. There is overlap with work being done by @samuelsov and @totten in core.Todo:
Although I wonder if it will be possible to share a list of selectors with core, considering that most cases are obscure things such as:
which I suspect we will not be able to parse with phpQuery?