Skip to content
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

Remove i18n code #2167

Merged
merged 42 commits into from Nov 27, 2015
Merged

Remove i18n code #2167

merged 42 commits into from Nov 27, 2015

Conversation

chrisroos
Copy link
Contributor

I also tried to remove the "rails-i18n" Gem as part of this pull request. Removing it caused a number of regression tests to fail because, for example, number_to_currency started returning $ instead of £.

Using this script was failing if/when the ERB question templates
contained interpolated values.

Using the `MethodMissingHelper` module allows us to avoid these
interpolation errors.
This script has now served its purpose. All flows have been converted
from using i18n templates to ERB templates.
I've had to introduce `Flow#use_i18n_templates_for_questions`
temporarily, so that I can keep all the tests passing.
It's now the default to use ERB templates for questions so we no longer
need to specify it explicitly.

I've reversed the assertions in the "change default renderer for
questions" test in test/unit/flow_test.rb. It now asserts that the first
question uses ERB and that the second has been switched to use I18n.

I've switched to using `Flow.build` instead of `Flow.new` and
`Flow#define` in flow_registration_presenter_with_erb_renderer_test and
graph_presenter_with_erb_renderer_test. This is because it's no longer
necessary to call `#use_erb_templates_for_questions` between
instantiation and the call to `#define`.
It's now the default to use ERB templates for questions so we no longer
need to specify it explicitly.

I've also updated the checksum data for each flow now that they've
changed.
It's now the default to use ERB templates for questions so we don't need
this option any more.
I've removed the flow_registration_presenter_test file because the
equivalent tests still exist
flow_registration_presenter_with_erb_renderer_test, but for when the
flow is using ERB question templates.

I've removed the two i18n yaml files that were only being used by this
test.
The name no longer needs to include "with_erb_renderer" as this is now
the only unit test for the FlowRegistrationPresenter.
And associated graph.yml locale file.
@chrisroos
Copy link
Contributor Author

I'm currently running all regression tests in this branch to ensure that I haven't inadvertently broken something.

@chrisroos
Copy link
Contributor Author

All regression tests passed in this branch on my local machine.

The name no longer needs to contain "with_erb_renderer" as this is now
the only unit test for the GraphPresenter.
And associated question-presenter-sample.yml file.

This test was exercising the i18n functionality of the
QuestionPresenter, which I'm in the process of removing.
The name no longer needs to include "with_erb_renderer" as this is now
the only unit test for the QuestionPresenter.
This removes the ability to disable ERB templates for questions.
Additionally stop passing the `use_erb_templates_for_questions` option
in `Flow#add_question`.
This is a small step toward removing it completely.
The `#use_erb_template?` method always returns true so this `else`
branch is never used.
The `use_erb_template?` method always returns true so this `else`
branch is never used.
The `use_erb_template?` method always returns true so this `else`
branch is never used.
The `use_erb_template?` method always returns true so this `else`
branch is never used.
The `use_erb_template?` method always returns true so this `else`
branch is never used.
The `use_erb_template?` method always returns true so this `else`
branch is never used.
The `use_erb_template?` method always returns true so this `else`
branch is never used.
The `use_erb_template?` method always returns true so this `else`
branch is never used.
The `use_erb_template?` method always returns true so this `else`
branch is never used.
This is no longer used anywhere.
These delegated methods are all redundant now that we only render ERB
templates for questions.
This is no longer being used anywhere.
Note that `StartNodePresenter#initialize` calls `super` and passes the
temporary 'unused-i18n-prefix' string. I'll remove this when I remove
`i18n_prefix` from `NodePresenter#initialize`.
I've had to add the conditional code to
`SmartAnswerPresenter#presenter_for` so that it instantiates the
`OutcomePresenter` correctly. This will go away once we're no longer
passing `i18n_prefix` to any of the `NodePresenter`s.

Note that `OutcomePresenter#initialize` calls `super` and passes the temporary
'unused-i18n-prefix' string. I'll remove this when I remove `i18n_prefix` from
`NodePresenter#initialize`.
I've had to amend the conditional code in
`SmartAnswerPresenter#presenter_for` so that it instantiates the
`OutcomePresenter` and `QuestionPresenter` correctly. This will go away
once we're no longer passing `i18n_prefix` to any of the
`NodePresenter`s.

Note that `QuestionPresenter#initialize` calls `super` and passes the
temporary 'unused-i18n-prefix' string. I'll remove this when I remove
`i18n_prefix` from `NodePresenter#initialize`.
I've removed the conditional code from
`SmartAnswerPresenter#presenter_for` now that all presenter
`#initialize` methods have the same signature (i.e. none of them take an
`i18n_prefix`) any more.
Setting the local `i18n_prefix` in the flow had/has no effect.

I've also updated the checksum data for legalisation-document-checker.
These are no longer being used anywhere.
We're no longer using i18n locale files to store content for Smart
Answers.
The `QuestionPresenter` now always renders ERB templates so we don't
need to worry about rescuing `I18n` exceptions.
None of the i18n helper methods are being used now that we've completely
switched to ERB templates for questions.
I'm not sure whether these were ever used as we no longer have (never had?) a
flow named 'holiday_pay'.
And use this instead of looking it up in I18n locale file using the
`flow.defaults.error_message` key.
We haven't been using PhraseLists for a while and so these test names
don't make sense.
This is no longer being used anywhere.
These are no longer used anywhere.
@chrisroos
Copy link
Contributor Author

I've tweaked some of the commit messages and force pushed in preparation for merging.

chrisroos added a commit that referenced this pull request Nov 27, 2015
@chrisroos chrisroos merged commit 1f9c2f5 into master Nov 27, 2015
@chrisroos chrisroos deleted the remove-i18n-code branch November 27, 2015 14:21
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.

None yet

1 participant