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

Extract markdown from content pages into localization jsons #612

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

overlordtm
Copy link
Contributor

This change make it possible to translate content pages into jsons, to be translated using Weblate.

Changes:

  • source of static pages is now src/locales/LANG.json, not the src/content/LANG/PAGE.md !!!
  • changes to md pages can be extracted to json using yarn extract-content. Script will read all *.md pages in src/content and REPLACE content.PAGE keys in src/locales/LANG.json with new values (extracted from PAGE.md). Other keys are not overriden, but file might be reformatted (effect of JSON.parse and JSON.stringify). Keep in mind this is no 2way sync, so extract will override changes from weblate. See TODO
  • Functionality of StaticPage remains the same, but there is new TranslatableStaticPage that takes single prop localeKey
const routes = [ ...
      {
        path: 'faq',
        component: TranslatableStaticPage,
        props: { localeKey: 'content.faq' }
      },
...]

As consequence, router.js is much simplified :)

TODO:

  • Test it everytwhere (mobile)
  • IMHO we should extract src/content just once and then remove it from source tree and just have it in Weblate (if weblate has decent markdown support?). This way we avoid problems if content is changed in md file and in weblate.

Andraz Vrhovec added 2 commits October 14, 2020 00:48
* content MD pages extracted into localization json-s using
scripts/extract-content.js
* New TranslatableStaticPage using Vuei18next for localization
@overlordtm overlordtm requested a review from stefanb October 13, 2020 23:21
@stefanb
Copy link
Member

stefanb commented Oct 14, 2020

I suggest we:

  • do just the json reordering once separately, before doing this, so the changes will be minimized. If there are other (eg indentation/encoding) differences we should try to eliminate them.
  • enable project forks to still do their translations, but now in weblate instead of .md files, preferably using contexts (eg MKD/ faq.md (we should check we have the latest ones from their forks!) content should get into pages.faq_MKD key)
  • delete .md files

@stefanb
Copy link
Member

stefanb commented Oct 14, 2020

Reordering keys in JSONs will cause conflicts with all branches that have these JSONs changed, so it should be done at just the right time, coordinated with other branch owners.

@overlordtm
Copy link
Contributor Author

I would suggest we find all open PR-s that have *.md files modified. We merge them, then I rebase on latest master, run extraction again (commit only additional keys, without reordered), remove original *.md files and merge this? This way we will end up only with additional keys in localization json-s, I think git should handle that.

@stefanb
Copy link
Member

stefanb commented Oct 18, 2020

Yes, that would be better

@stefanb
Copy link
Member

stefanb commented Oct 18, 2020

Also we have many .md pages placeholders, so we shouldn't put those in translations

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
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

2 participants