|
| 1 | +title: CC Search, Setting up vue-i18n and internationalizing homepage |
| 2 | +--- |
| 3 | +categories: |
| 4 | +cc-search |
| 5 | +community |
| 6 | +gsoc |
| 7 | +open-source |
| 8 | + |
| 9 | +--- |
| 10 | +author: AyanChoudhary |
| 11 | +--- |
| 12 | +series: gsoc-2020-ccsearch-accessibility |
| 13 | +--- |
| 14 | +pub_date: 2020-06-10 |
| 15 | +--- |
| 16 | +body: |
| 17 | + |
| 18 | +These are the first two weeks of my internship with CC. I am working on improving the accessibility of cc-search and internationalizing it as well. |
| 19 | +We started with first compiling the accessibility reports from accessibility insights, lighthouse and pa11y into a single document and then opening up appropriate issues ont he repo to address them. |
| 20 | + |
| 21 | +The accessibility issues are listed here: |
| 22 | +1. [Accessibility - Improve labels](https://github.com/creativecommons/cccatalog-frontend/issues/996) |
| 23 | +2. [Evaluate keyboard navigation effectiveness](https://github.com/creativecommons/cccatalog-frontend/issues/997) |
| 24 | +3. [Fix color contrast problems](https://github.com/creativecommons/cccatalog-frontend/issues/998) |
| 25 | +4. [Improve elements markup](https://github.com/creativecommons/cccatalog-frontend/issues/999) |
| 26 | +5. [Evaluate any accessibility linter tools](https://github.com/creativecommons/cccatalog-frontend/issues/1000) |
| 27 | + |
| 28 | +The decision was made to audit the tab indices along with internationalizing the page. |
| 29 | +The accessibility changes will be done after the completion of internationalization as the aria-labels will have to be internationalized as well. |
| 30 | + |
| 31 | +The first two weeks involved setting up vue-i18n, auditing the tab index for homepage and internationalizing it. |
| 32 | +The tab index adit for homepage is displayed: |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +The internationalization part was pretty straightforward, we just had to export all the strings to the JSON files and load transaltions through the i18n module. |
| 37 | +For complex elements of the type ```string <tag>string</tag> string``` I went for the templating method. |
| 38 | +Here we use the v-slot attribute of the i18n functional component to convert the element into a template where the tag occupies a slot in the syntax. |
| 39 | + |
| 40 | +``` |
| 41 | +<i18n path="footer.caption.label" tag="p" class="caption"> |
| 42 | + <template v-slot:noted> |
| 43 | + <a href="https://creativecommons.org/policies#license" target="_blank" rel="noopener">{{$t('footer.caption.noted')}}</a> |
| 44 | + </template> |
| 45 | + <template v-slot:attribution> |
| 46 | + <a href="https://creativecommons.org/licenses/by/4.0/" target="_blank" rel="noopener"> |
| 47 | + {{$t('footer.caption.attribution')}} |
| 48 | + </a> |
| 49 | + </template> |
| 50 | + <template v-slot:icons> |
| 51 | + <a href="https://fontawesome.com/" target="_blank" rel="noopener" class="has-text-white"> |
| 52 | + {{$t('footer.caption.icons')}} |
| 53 | + </a> |
| 54 | + </template> |
| 55 | +</i18n> |
| 56 | +``` |
| 57 | + |
| 58 | +The final outcome looks pretty good: |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +And voila we are done with the first two weeks. I also internationalized the header and the footer along with the homepage. |
| 63 | +You can track the work done for these weeks through these PRs: |
| 64 | + |
| 65 | +1. [setup internationalization plugin](https://github.com/creativecommons/cccatalog-frontend/pull/1007) |
| 66 | +2. [Internationalize homepage, header and footer](https://github.com/creativecommons/cccatalog-frontend/pull/1013) |
| 67 | + |
| 68 | +The progress of the project can be tracked on [cc-search](https://github.com/creativecommons/cccatalog-frontend) |
| 69 | + |
| 70 | +CC Search Accessiblity is my GSoC 2020 project under the guidance of [Ari Madian](https://opensource.creativecommons.org/blog/authors/akmadian/), who is the primary mentor for this project, [Anna Tumadóttir](https://creativecommons.org/author/annacreativecommons-org/) for helping all along and engineering director [Kriti |
| 71 | +Godey](https://creativecommons.org/author/kriticreativecommons-org/), have been very supportive. |
0 commit comments