8000 [Translation] Refresh catalogues when resources change by iamluc · Pull Request #13074 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Translation] Refresh catalogues when resources change #13074

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

Merged
merged 1 commit into from
Feb 5, 2015

Conversation

iamluc
Copy link
Contributor
@iamluc iamluc commented Dec 22, 2014
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #11530
License MIT
Doc PR no

When a translation file is added in a bundle, the container is refreshed thanks to a DirectoryResource watching for changes.
But the translator has his own cache that is not refreshed.

This PR adds a hash check when cached is used.

@sstok
Copy link
Contributor
sstok commented Dec 22, 2014

👍

Btw. Test are missing.

@saro0h
Copy link
Contributor
saro0h commented Dec 23, 2014

👍

$this->catalogues[$locale] = include $cache;
list($catalogue, $resourcesHash) = include $cache;

if ($this->debug && ($resourcesHash !== $this->getResourcesHash($locale))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parenthesis on the second condition are not needed and should be removed.

@iamluc iamluc force-pushed the translation-cache2 branch from 8659ab9 to 1113999 Compare January 24, 2015 14:46
@iamluc
Copy link
Contributor Author
iamluc commented Jan 24, 2015

Added unit test

@fabpot
Copy link
Member
fabpot commented Feb 5, 2015

Thank you @iamluc.

@fabpot fabpot merged commit 1113999 into symfony:2.7 Feb 5, 2015
fabpot added a commit that referenced this pull request Feb 5, 2015
… (iamluc)

This PR was merged into the 2.7 branch.

Discussion
----------

[Translation] Refresh catalogues when resources change

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11530
| License       | MIT
| Doc PR        | no

When a translation file is added in a bundle, the container is refreshed thanks to a DirectoryResource watching for changes.
But the translator has his own cache that is not refreshed.

This PR adds a hash check when cached is used.

Commits
-------

1113999 Refresh catalogues when resources change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0