Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Internationalize homepage, header and footer #1013

Merged
merged 1 commit into from Jul 1, 2020

Conversation

ayanchoudhary
Copy link
Contributor

Fixes

Fixes #942 by @brenoferreira

Description

Internationalizes the CC search homepage

Screenshots

CC Search - Brave 12-06-2020 01_56_18

CC Search - Brave 12-06-2020 01_56_26

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the master branch of the repository.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@ayanchoudhary ayanchoudhary requested review from kgodey, annatuma, akmadian and a team June 11, 2020 20:28
@kgodey kgodey added this to In Progress in Active Sprint Jun 11, 2020
@ayanchoudhary
Copy link
Contributor Author

ayanchoudhary commented Jun 11, 2020

@akmadian @kgodey I have completed the task of internationalizing the homepage but I have a query about what I should do with the license types. For eg. on the homepage we have Use Commercially and Modify or Adapt so should I leave them as it is or should I internationalize them as well

@kgodey
Copy link
Contributor

kgodey commented Jun 12, 2020

@ayanchoudhary what are the reasons for and against internationalizing them?

@kgodey kgodey moved this from In Progress to Ready for Development in Active Sprint Jun 12, 2020
@akmadian
Copy link
Contributor

@ayanchoudhary I would also like to hear your thoughts on the pros and cons of internationalizing them.

@ayanchoudhary
Copy link
Contributor Author

@kgodey @akmadian there aren't any pros and cons related to internationalizing them. The decision rests on the fact whether these phrases are the actual representations of the licenses which are supposed to be definitive or whether these phrases just symbolically represent them

@ayanchoudhary
Copy link
Contributor Author

@akmadian this branch is already pointing to internationalization so once we the internationalization of the license part gets decided we can merge it into that branch.

@kgodey
Copy link
Contributor

kgodey commented Jun 17, 2020

@ayanchoudhary as discussed on Slack, please go ahead and internationalize those strings.

@akmadian
Copy link
Contributor

@ayanchoudhary Please tag me here on github when you are ready for final review :)

@ayanchoudhary
Copy link
Contributor Author

So I was going through the process of internationalizing the license strings(which are coming from the vuex store), turns out vue-i18n does not provide any inbuilt support for internationalizing vuex-store out of the box. I found (this package built on vue-i18n)[https://github.com/dkfbasel/vuex-i18n] but it hasn't been updated since a year. So should I go ahead with it? @akmadian @kgodey

@kgodey kgodey moved this from Ready for Development to In Progress in Active Sprint Jun 26, 2020
@zackkrida
Copy link
Contributor

zackkrida commented Jun 29, 2020

Hi @ayanchoudhary, I am going to look into this even deeper for you, but I may have found a possible solution. The vue-i18n plugin has a mergeLocaleMessage method that can be used to set translation strings on a locale.

This is the basic idea:

<template>
    <p>{{ $t("hello") }}</p>
</template>

<script>
export default {
  name: "any-component",
  mounted() {
    this.$i18n.mergeLocaleMessage("en", {hello: this.$state.store.hello });
  }
};
</script>

I made a small demo here you can check out: I made you a quick demo here: https://codesandbox.io/s/mergelocalemessage-proof-of-concept-rx1j5

Let me know what you think! I believe this solves the issue of storing translation strings inside of vuex, but there may be some details specific to the cc search project that I am missing.

@ayanchoudhary
Copy link
Contributor Author

Hi @zackkrida thanks for the demo, but the problem which we have here is actually the exact opposite of that from the sandbox, like here we have the translation strings in the normal messages format and the en strings in the store, but I guess we can reverse it to fix that out, let me try it out on the code. Will keep you updated 😃.

@brenoferreira
Copy link
Contributor

brenoferreira commented Jun 29, 2020

@ayanchoudhary ideally, the translations should be in the locale messages JSON file. If they keys are well defined, a function can map the code in the store to the key path of the locale message, something like:

mapFilterCodeToMessageKey(filterCode = 'licenseTypes.commercial') => 'filters.licensesTypes.commercial'

I think trying to "localize the store" is unnecessary complexity and you remove the hardcoded name strings out of the store

@zackkrida
Copy link
Contributor

zackkrida commented Jun 29, 2020

@brenoferreira thank you so much; I understand the issue now! @ayanchoudhary the basic idea is that you remove the name property out of each item in filterData, and move those name values into the locale messages JSON files, in a shape so they can be mapped by their keys. Something like this (for licenseType as an example:

// would actually just be in the locale json files,  but you get the idea
const messages = {
  en: {
    filters: {
      licenseType: {
        commercial: 'Use commercially',
        modification: "Modify or adapt"
      }
    }
  }
};

thanks again @brenoferreira

@akmadian akmadian merged commit ccd2ee3 into internationalization Jul 1, 2020
Active Sprint automation moved this from In Progress to Done Jul 1, 2020
@akmadian akmadian deleted the localize-homepage branch July 1, 2020 20:30
Copy link
Contributor

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

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

Given that the license types were included as part of your other PR, this looks complete! Thank you.

@dhruvkb dhruvkb added 📄 aspect: text Concerns the textual material in the repository 🕹 aspect: interface Concerns end-users' experience with the software labels Oct 25, 2020
@TimidRobot TimidRobot removed this from Done in Active Sprint Jan 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🕹 aspect: interface Concerns end-users' experience with the software 📄 aspect: text Concerns the textual material in the repository internationalization (i18n)
Development

Successfully merging this pull request may close these issues.

None yet

6 participants