openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
656 stars 386 forks source link

Enable in-line Crowdin translations for logged in users/moderators #5610

Open teolemon opened 3 years ago

teolemon commented 3 years ago

What

How

Integration Add the following JavaScript snippet to your website, on the pages, where the widget should be displayed, right before the closing tag.

<script
  type="text/javascript"
  src="https://crowdin.com/js/crowdjet/crowdjet.js">
</script>
<div
  id="crowdjet-container"
  data-project-id="243092"
  style="bottom: 90px; right: 20px;">
</div>
<div
  id="crowdjet-expand-container"
  style="bottom: 10px; right: 20px;">
</div>

Note! Each person who clicks on the widget will have to choose from the list of all the project's target languages before contributing. If you want to skip this step – predefine the target language at the beginning, by adding the language code to the snippet. Please remember, that people will still be able to change the language in the widget settings. Crowdin language codes Here's how a part of the snippet with a predefined French target language looks like:

<div
  id="crowdjet-container"
  data-project-id="243092"
  data-language-code="fr"
  style="bottom: 90px; right: 20px;">
</div>

Part of

hangy commented 3 years ago

Crowdin Docs: https://support.crowdin.com/in-context-localization/

This needs to be embedded in the lol language code (only?), because the in-context translation works using the crwdns164862:0crwdne164862:0 meta language values. Therefore, this is probably blocked by #667?

I think this updated syntax replaces #1738 and #2421.

stephanegigandet commented 3 years ago

The easiest would be to symlink an unused 2 language code (e.g. "ll") to "lol". I'm testing it on the dev server. There will be some issues to resolve though, first one I noticed is that $file_timestamps{'css/dist/app-' . lang('text_direction') . '.css'}; doesn't work at all if we have a crowdin identifier for lang('text_direction')

teolemon commented 1 year ago

@raphael0202 makes the point (probably valid) that we should disable the basic widget (not the inline thing which is not implemented yet) for non logged-in users.

github-actions[bot] commented 9 months ago

This issue has been open 90 days with no activity. Can you give it a little love by linking it to a parent issue, adding relevant labels and projets, creating a mockup if applicable, adding code pointers from https://github.com/openfoodfacts/openfoodfacts-server/blob/main/.github/labeler.yml, giving it a priority, editing the original issue to have a more comprehensive description… Thank you very much for your contribution to 🍊 Open Food Facts