decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.81k stars 3.04k forks source link

Is there or could there be a good workflow for using the CMS to do translation? #342

Closed fool closed 6 years ago

fool commented 7 years ago

- Do you want to request a feature or report a bug?

feature

- What is the current behavior?

missing feature :)

- If the current behavior is a bug, please provide the steps to reproduce.

n/a

- What is the expected behavior?

the hoped-for behavior is that the CMS would support a workflow that allows for translation of a set of fixed strings. It may already do this, so the solution to this issue may be "here's a way to set up that workflow" but @dkjess and I were talking and I didn't have one at hand.

Suppose that your app uses strings for all of the text in the site. The site is built from some arbitrary-format files (e.g. ERB files). Is there a way that this and only this could be handled by the CMS? My suggestion was something like:

  1. use a markdown file to contain the original strings and placeholders for their translations
  2. use the CMS to edit that markdown file (already supported by the CMS) and
  3. pull the content from the markdown file into your app using a script (something smarter than, but resembling "TOKEN1_SPANISH=grep TOKEN1_SPANISH input.md | cut -d= -f2 sed s/TOKEN1_SPANISH/$TOKEN1_SPANISH/g file.erb" and cycling through the tokens to repeat.

I guess the big hangup is, this wouldn't be a category, doesn't need media files, etc - just wants a git-backed way to expose just this file for editing to the content team, whose commit could still trigger a site build. Clearly there would need to be some sanity checking in the script, but besides that, any advice on achieving this workflow?

- Please mention your node.js, and operating system version.

shouldn't matter :)

josephearl commented 7 years ago

@fool it's an interesting idea - but I think this is more the job of static site generators like Jekyll or Hugo.

There is a plugin for Jekyll that can do something like this https://github.com/Anthony-Gaudino/jekyll-multiple-languages-plugin - and you would be able to edit those files using Netlify CMS by defining collections for the localization files.

erquhart commented 6 years ago

@fool closing, I agree that this is probably out of scope for the cms.