NolanKingdon/MMM-MoonPhase

Spanish translation breaks MagicMirror

drakhart opened this issue · 0 comments

MagicMirror gets completely broken (black screen) when using Spanish language with MMM-MoonPhase.

Expected Behavior

MagicMirror should work fine, and MMM-MoonPhase should display texts in Spanish.

Current Behavior

MagicMirror doesn't work at all (black screen). JavaScript console displays the following error:

Uncaught SyntaxError: Unexpected token / in JSON at position 0
    at JSON.parse (<anonymous>)
    at XMLHttpRequest.xhr.onreadystatechange (translator.js:22)

Possible Solution

Fix the Spanish translation file.

Steps to Reproduce

  1. Install MMM-MoonPhase.
  2. Set MagicMirror's language to es.
  3. Run MagicMirror with npm start.
  4. Access MagicMirror's website. It will be just a black screen.

Context (Environment)

Operating system: Debian GNU/Linux 10 (buster)
Node.js version: 12.17.0
MagicMirror version: 2.13.0
MMM-MoonPhase version: 1.0.1

Detailed Description

The Spanish translation file, translations/es.json, starts with the following commented line:

// Thanks to margaritamc

JSON files don't accept comments, only JSONC files do. Adding a comments to JSON renders it invalid.

Possible Implementation

Remove the commented line. Make sure that the resulting file is JSON compliant.