Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Translation] Fixed the addition of the fallbackLocale catalogue to the current locale catalogue. #116

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
3 commits merged into from
Feb 27, 2011
Merged

[Translation] Fixed the addition of the fallbackLocale catalogue to the current locale catalogue. #116

3 commits merged into from
Feb 27, 2011

Conversation

cristiangsp
Copy link

When loading a catalogue the function "optimizeCatalogue" add the fallback catalogue to the current locale catalogue. This should be done by first adding the language catalogue and finally adding the fallbacklocale catalogue specified in the configuration. This subsequent additions are done by the "loadCatalogue" function.

The problem is that in the "loadCatalogue" function exists an if statement that checks if the resource of a given locale exists before loading it. If not, the function simply returns. This return implies that the subsequent addition of the fallbacklocale wouldn't be done.

This has been fixed by simply replacing the current if statement and adding a new one that, if the resource exists, then executes the process of resource loading. Finally, the function continue calling the "optimizeCatalogue" function.

@fabpot
Copy link
Member

fabpot commented Feb 27, 2011

Can you add some unit tests that show the problem you fix with this patch?

@cristiangsp
Copy link
Author

I have modified the actual FallbackLocale test trying to show the behaviour that shows the error.

cgonzalez added 3 commits February 27, 2011 12:32
When the current locale catalogue doesn't contain the id searched, the code doesn't search in the fallbacklocale catalogue (as is explained in the documentation).
Added the search to the fallbacklocale catalogue to the translation function.
…he current locale catalogue.

When loading a catalogue the function "optimizeCatalogue" add the fallback catalogue to the current locale catalogue. This should be done by first adding the language catalogue and finally adding the fallbacklocale catalogue specified in the configuration. This subsequent additions are done by the "loadCatalogue" function.

The problem is that in the "loadCatalogue" function exists an if statement that checks if the resource of a given locale exists before loading it. If not, the function simply returns. This return implies that the subsequent addition of the fallbacklocale wouldn't be done.

This has been fixed by simply replacing the current if statement and adding a new one that, if the resource exists, then executes the process of resource loading. Finally, the function continue calling the "optimizeCatalogue" function.
…cale"

Now the test shows the behavior when is requested a translation to an undefined locale catalogue and, therefore, the fallbacklocale catalogue must be queried. The original test function only checks the step to reach the language catalog not to the fallbacklocale one (even the fallbacklocale isn't set). This test gives error in the current version of symfony/symfony.
SofHad pushed a commit to SofHad/symfony that referenced this pull request Oct 12, 2015
This PR was merged into the master branch.

Discussion
----------

Romanian translation

Romanian translations based on symfony#80

Commits
-------

4b89fbc Romanian translation
jderusse pushed a commit to jderusse/symfony that referenced this pull request Mar 30, 2020
jderusse pushed a commit to jderusse/symfony that referenced this pull request Mar 30, 2020
I was off by one in one situation and all of 2.5.x is vulnerable.

Refs symfony#116
chalasr pushed a commit to chalasr/symfony that referenced this pull request Sep 24, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants