-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Translation] [Loco] Send If-Modified-Since
header when possible
#44484
[Translation] [Loco] Send If-Modified-Since
header when possible
#44484
Conversation
If-Modified-Since\
header when possible, close #44414If-Modified-Since\
header when possible, close #44414
If-Modified-Since\
header when possible, close #44414If-Modified-Since
header when possible, close #44414
<xsd:element name="prop-group"> | ||
<xsd:complexType> | ||
<xsd:sequence maxOccurs="unbounded"> | ||
<xsd:element ref="xlf:prop"/> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" use="optional"/> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="prop"> | ||
<xsd:complexType> | ||
<xsd:simpleContent> | ||
<xsd:extension base="xsd:string"> | ||
<xsd:attribute name="prop-type" type="xsd:string" use="required"/> | ||
<xsd:attribute ref="xml:lang" use="optional"/> | ||
</xsd:extension> | ||
</xsd:simpleContent> | ||
</xsd:complexType> | ||
</xsd:element> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to add declarations prop-group
/prop
, otherwise it breaks because we have some validations on XLIFF files.
I'm not sure to understand why PHPUnit tests are failing:
The file Do someknow what's going on here? Thanks! |
Hey! I think @rvanlaak has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some little comments.
I guess we need to update the changelog of Translation component, because this PR add support of prop-group
and prop
XLIFF tags?
WDYT @stof @nicolas-grekas?
src/Symfony/Component/Translation/Catalogue/TargetOperation.php
Outdated
Show resolved
Hide resolved
Thanks for your comments :) We still have the issue when running tests, and this issue only happens in CI:
ping @nicolas-grekas @stof, do you know what can happens here? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great already. Do you have an idea whether the other translation providers also support the If-Modified-Since
header?
src/Symfony/Component/Translation/CatalogueMetadataAwareInterface.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/CatalogueMetadataAwareInterface.php
Outdated
Show resolved
Hide resolved
If-Modified-Since
header when possible, close #44414If-Modified-Since
header when possible
Status: needs review |
If-Modified-Since
header when possibleIf-Modified-Since
header when possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code is ok for me, but we will need @nicolas-grekas or @stof help to fix the failing test, I have difficulties to understand what is wrong here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding BC layers for the added constructor parameters should help fixing the failing tests, at least the high-deps one.
For low-deps, we may need to bump the symfony/translation
requirement in Loco Bridge's composer.json to ^6.1
to make it always has the new interfaces.
src/Symfony/Component/Translation/CatalogueMetadataAwareInterface.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Bridge/Loco/LocoProviderFactory.php
Outdated
Show resolved
Hide resolved
New constructor parameters should be mentioned in CHANGELOG/UPGRADE files also |
Thanks for your comments @chalasr, the The failures are unrelated IMO. Status: needs review |
...fony/Component/Translation/Bridge/Loco/Tests/LocoProviderFactoryWithoutTranslatorBagTest.php
Outdated
Show resolved
Hide resolved
...fony/Component/Translation/Bridge/Loco/Tests/LocoProviderFactoryWithoutTranslatorBagTest.php
Outdated
Show resolved
Hide resolved
...fony/Component/Translation/Bridge/Loco/Tests/LocoProviderFactoryWithoutTranslatorBagTest.php
Outdated
Show resolved
Hide resolved
Review comments have been addressed, deprecations have been removed and some tests fixed. Status: needs review |
...fony/Component/Translation/Bridge/Loco/Tests/LocoProviderFactoryWithoutTranslatorBagTest.php
Outdated
Show resolved
Hide resolved
*/ | ||
class LocoProviderFactoryWithoutTranslatorBagTest extends LocoProviderFactoryTest | ||
{ | ||
use ExpectDeprecationTrait; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the full test case can be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice to ensure the LocoProviderFactory
still works even without the TranslatorBag
. WDYT?
src/Symfony/Component/Translation/Bridge/Loco/Tests/LocoProviderWithoutTranslatorBagTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Bridge/Loco/Tests/LocoProviderWithoutTranslatorBagTest.php
Outdated
Show resolved
Hide resolved
The PR has been rebased, failures are not related. |
Is there anything else to do? |
Thank you @Kocal. |
This PR is a proposal for #44414.
When pulling translations from Loco, we save the
Last-Modified
response header in eachMessageCatalogue
thanks to the newCatalogueMetadataAwareInterface
.When pulling translations one more time from Loco, we send the previous
Last-Modified
response header asIf-Modified-Since
request header if it's available.If Loco returns a 304, we don't update current translations. If it's not the case, we keep the original behaviour.
Catalogue metadata can be used to store metadata about the catalogue itself and not about translations.
Actually, only
.xliff
format is supported (read/write).WDYT?
Thanks!
cc @welcoMattic