-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Backport] Refactor code shared by admin-translatable resources #2896
Merged
voodoorai2000
merged 17 commits into
consuldemocracy:master
from
javierm:backport-refactor-translatable-shared-code
Sep 17, 2018
Merged
[Backport] Refactor code shared by admin-translatable resources #2896
voodoorai2000
merged 17 commits into
consuldemocracy:master
from
javierm:backport-refactor-translatable-shared-code
Sep 17, 2018
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Suggested by @javierm so that we can take advantage of certain browser features that rely on a <label> tag being associated with an <input> tag.
To avoid having multiple top-level classes per file
Label for field :title should be "Title", not "Title en"
It turns out it is not necessary to downcase and underscore locale names to use the globalize-accessor gem. The gem will automatically underscore the locale name when defining and calling the accessor methods.
The application default_locale is :es, while most seed data is created in English. This means that translatable resources might only have English translations. This change is so that, when the locale is set to Spanish, the English translations are shown instead of empty content.
In the past there have been issues with the `pt-BR` locale because it has a hyphen `-` and a uppercase letters. I am adding the test only to spec/features/translations_spec.rb (which tests Milestones) for now. We might want to also add it to the other translatable resource specs in the future (banners, etc.).
This fallback was added with the following explanation: The application default_locale is :es, while most seed data is created in English. This means that translatable resources might only have English translations. This change is so that, when the locale is set to Spanish, the English translations are shown instead of empty content. Instead, we are going to make sure that all seed content for translatable resources is available in both English and Spanish.
javierm
changed the title
[Backport] Refactor code shared by admin-translatable resources
[WIP] [Backport] Refactor code shared by admin-translatable resources
Sep 11, 2018
It fails because we try to follow a link without a Portuguese translation. In Madrid they use Spanish as fallback, but in consul we use English as fallback, and so the text in the link is different in those repos. A proper solution would be to update the Portuguese locales. However, since this test is going to be removed in our next backport, I'm just doing a quick patch.
javierm
changed the title
[WIP] [Backport] Refactor code shared by admin-translatable resources
[Backport] Refactor code shared by admin-translatable resources
Sep 12, 2018
Fabulous! 🙌 |
This was referenced Sep 17, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References
Objectives
Quoting from AyuntamientoMadrid#1613 (all credit to Marko):
Notes