Kronos / User Glossary for MTL

Published:

Version: 1.12.8+49c5b96 updated

Summary: User glossary fetched from google docs spreadsheet for lnmtl.com

License: MIT

Features:

  • Apply newest terms directly from the LNMTL glossary to the chapter, so that the chapters improve even without a re-translation or any additional user glossary. To enable this feature you need to be logged in on lnmtl.com and also have it turned on in the settings dialog.
  • Glossary Analyser button added to novel info page, it lists out of order terms and duplicates (see it in action).
  • Use a simple google docs spreadsheet as a additional user glossary for lnmtl.com.
    Bridge the time until the next re-translation happens or just replace subjectively unlikable terms.

IMPORTANT: Google has shutdown their v3 Spreadsheet API completely. Therefore multi-sheet spreadsheets are not fully supported without a Google API-Key. Meaning only the first sheet is accessible and used by the script. You can still rearrange the sheets manually in the spreadsheet to switch the used terms. Changes to the spreadsheet also may take up to 10 minutes before they are applied.

Get full multi-sheet support back by activating the new "Multi-Sheet Spreadsheet" feature in the settings dialog. This feature requires a Developer API-Key from Google:

  1. Create a new project
  2. Enable Google Sheets API
  3. Create a API-Key
  4. Use the key when you activate the "Multi-Sheet Spreadsheet" feature
    HINT: Another upside of using a API-Key is that changes on the spreadsheet will be immediately applied.

For more information visit: https://developers.google.com/webmaster-tools/search-console-api/v1/configure

Usage:

  1. Install tampermonkey.net browser extension.
  2. After the extension is installed click here to install this user script.
  3. Go to lnmtl.com and click on settings to find all the new glossary options. To use the user glossary continue with steps 4 to 8, otherwise you're done.

Optional: use your own glossary

  1. Create a google spreadsheet [spreadsheet example]
  • Supported column names: "raw", "meaning", "overwrite" (additional can be created for convenience but will not effect the user glossary). "raw" and "meaning" are mandatory and need to be added to the spreadsheet.
  • Set overwrite to TRUE if translated glossary terms should also be replaced.
  • Name the table-sheet (tab at the bottom) to support multiple novels.
    • If there is a single table-sheet it will be used no matter the name.
    • If there are multiple-sheets it searches for a name to match the novel based on the chapter URL
      e.g. https://lnmtl.com/chapter/super-emperor-44 => : super-emperor or Super Emperor
      (hyphens and whitespaces can be used interchangeable and case insensitive).
    • If there exists a table-sheet named Global, then it will be applied in addition to the novel specific one.
  1. Click on the green "share" button in the upper right corner and then click on "Get shareable link" in the new prompt and save the link you get.
  2. Publish the document to the web: File -> "Publish to the web..." [see image down below].
  3. Go to lnmtl.com and click on settings and paste the public spreadsheet link (from step 5) in the new text-field.
  4. Now add terms to the spreadsheet and enjoy!

Notes:

  • This is just an advanced text replacer without a translation engine. It will search for a match of the term in the translated sentence. If some terms are not replaced by the script, characters are either missing or in the wrong order inside the translated sentence. Better results will always be with the on-site glossary after a re-translation. This is just a means to read ahead more easily, especially in novels with a small existing glossary. Don't forget to add the term to the normal glossary!

  • If the machine translation splits-up or rearranges characters of a term (in the translated sentence), then the terms will be only replaced where either the characters are only split-up by fill-words (the, to, of, in, on, ...) and not rearranged or if characters are only rearranged(in a recognizable pattern) but not split-up. Or in case of missing characters, it's required that the remaining characters of a term stay together and form a "unique sequence" inside a paragraph to determine exactly where they belong.

  • Use the overwrite _flag _ in the user glossary to make sure that a term will extend shorter ones where possible. This applies also to the automatic restoration of missing characters. For example if a shorter term matches a "missing-sequence" it will only be extended by the longer term if the overwrite _flag _ of the longer term is set to TRUE. Also if the overwrite _flag _ is set to TRUE the user glossary terms have priority over the LNMTL glossary entries and will also overwrite the "latest approved terms"-glossary. The terms within each glossary are applied in order of entry.

  • "newest approved terms" reapplies all currently approved lnmtl glossary terms, which are used in the respective chapters.
    This means new and changed terms will be used in the chapter without a need to wait for the re-translation. Note: Deleted terms will still be in the chapter until the next re-translation.

  • The "newest approved terms" are cached to prevent downloading the glossary for every chapter. It checks periodically on the novel page the "Glossary changes till next re-translation" count, if it's changed the cached glossary will be updated. Hint: By browsing to the novel info page the script will also notice if there are any changes and update the cache if necessary.

3rd Party Script API:

How to check if this script has replaced all terms

The recommended way to check if this script has finished replacing the terms, is to check the userjs_UGMTLComplete performance mark
(Note: requires version >= 1.6.14). Check this with: window.performance.getEntriesByName('userjs_UGMTLComplete').length > 0 .

If the 3rd-Party script runs prior to this script, it can add a listener for the following event: document.dispatchEvent(new Event('userjs_UGMTLComplete'));

Other useful stuff:

  • check if this script has been loaded:
    document.getElementById('replaceInOriginal') !== null
  • check if this script will replace the original-raws:
    $("#replaceInOriginal")[0] && $("#replaceInOriginal")[0].checked === true
  • activate the "Replace all raws in source sentence" setting:
    document.getElementById('replaceInOriginal').checked = true; $("#replaceInOriginal").change();

New Settings Dialog:

  • lnmtl settings

Glossary Analyser:

  • Glossary Analyser

Google docs examples:

gdocs glossary:

  • gdocs glossary

gdocs publish link:

  • gdocs share link

Rating: 1

1 Votes
-1