Sv443 4 месяцев назад
Родитель
Сommit
2c6adc7850

+ 48 - 0
.vscode/schemas/locales.schema.json

@@ -0,0 +1,48 @@
+{
+  "$schema": "http://json-schema.org/draft-07/schema#",
+  "type": "object",
+  "description": "All locales and translations that are available in BYTM",
+  "patternProperties": {
+    "^[a-z]{2}-[A-Z]{2}$": {
+      "type": "object",
+      "required": ["name", "nameEnglish", "emoji", "userscriptDesc", "authors", "altLocales"],
+      "description": "Locale code in the format ll-CC (language-country)",
+      "properties": {
+        "name": {
+          "type": "string",
+          "description": "Name and country of the language, e.g. \"Deutsch (Deutschland)\""
+        },
+        "nameEnglish": {
+          "type": "string",
+          "description": "English name and country of the language, e.g. \"German (Germany)\""
+        },
+        "emoji": {
+          "type": "string",
+          "pattern": "^[\uD83C\uDDE6-\uDDFF\uD83C\uDDE6-\uDDFF]{4}$",
+          "description": "Flag emoji of the country"
+        },
+        "userscriptDesc": {
+          "type": "string",
+          "description": "Localized userscript description (from \"description\" in package.json)"
+        },
+        "authors": {
+          "type": "array",
+          "items": {
+            "type": "string"
+          },
+          "description": "List of authors that contributed to the translation"
+        },
+        "altLocales": {
+          "type": "array",
+          "items": {
+            "type": "string",
+            "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
+          },
+          "description": "Alternative locale codes that will be redirected to this locale, e.g. for all German languages: [\"de\", \"de-AT\", \"de-CH\", \"de-LI\", \"de-LU\"]"
+        }
+      },
+      "additionalProperties": false
+    }
+  },
+  "additionalProperties": false
+}

+ 25 - 0
.vscode/schemas/require.schema.json

@@ -0,0 +1,25 @@
+{
+  "$schema": "http://json-schema.org/draft-07/schema#",
+  "type": "array",
+  "description": "Configuration for libraries loaded via @require (only supports UMD bundles or user libraries)",
+  "items": {
+    "type": "object",
+    "required": ["pkgName", "global"],
+    "description": "Configuration for a library (via UMD bundle or global variable)",
+    "properties": {
+      "pkgName": {
+        "type": "string",
+        "description": "Full identifier of the NPM package"
+      },
+      "path": {
+        "type": "string",
+        "description": "Path to the package's UMD/global bundle file, relative to the library root folder"
+      },
+      "global": {
+        "type": "string",
+        "description": "Name of the global variable created in the package's UMD/global bundle"
+      }
+    },
+    "additionalProperties": false
+  }
+}

+ 52 - 0
.vscode/schemas/resources.schema.json

@@ -0,0 +1,52 @@
+{
+  "$schema": "http://json-schema.org/draft-07/schema#",
+  "type": "object",
+  "required": ["resources"],
+  "description": "Contains all resources (images, fonts, stylesheets, etc.) used by BYTM",
+  "properties": {
+    "alwaysExternalAssetPatterns": {
+      "type": "array",
+      "description": "List of patterns passed to `new RegExp()` that should always be considered external assets (they won't be loaded via @resource)",
+      "items": {
+        "type": "string",
+        "format": "regex"
+      }
+    },
+    "resources": {
+      "type": "object",
+      "description": "Mapping of resource file identifiers and paths",
+      "patternProperties": {
+        "^[a-zA-Z]([a-zA-Z0-9_]+)?-[a-zA-Z0-9-_]+$": {
+          "description": "Resource key in the format `prefix-resource_name`",
+          "oneOf": [
+            {
+              "type": "string"
+            },
+            {
+              "type": "object",
+              "required": ["path"],
+              "properties": {
+                "path": {
+                  "type": "string",
+                  "description": "Path or URL to the resource. If it starts with /, it's relative to the project root, else it's relative to the assets folder. Query strings and hashes are allowed. You may make use of $MODE, $BRANCH, $HOST, $BUILD_NUMBER and $UID"
+                },
+                "ref": {
+                  "type": "string",
+                  "description": "Branch, tag, or commit SHA to use when fetching the resource. You may make use of $MODE, $BRANCH, $HOST, $BUILD_NUMBER and $UID"
+                },
+                "integrity": {
+                  "type": "boolean",
+                  "default": true,
+                  "description": "Whether to calculate a Subresource Integrity hash for the resource (works with any URLs too)"
+                }
+              },
+              "additionalProperties": false
+            }
+          ]
+        }
+      },
+      "additionalProperties": false
+    }
+  },
+  "additionalProperties": false
+}

+ 25 - 0
.vscode/schemas/translation.schema.json

@@ -0,0 +1,25 @@
+{
+  "$schema": "http://json-schema.org/draft-07/schema#",
+  "type": "object",
+  "required": ["translations"],
+  "description": "Translation file for a specific locale",
+  "properties": {
+    "base": {
+      "type": "string",
+      "pattern": "^[a-z]{2}-[A-Z]{2}$",
+      "description": "Optional base locale from which all missing translations are automatically inherited. Must be in the format ll-CC (language-country), e.g. en-US"
+    },
+    "translations": {
+      "type": "object",
+      "description": "Mapping of translation keys to strings",
+      "patternProperties": {
+        "^[a-zA-Z]([a-zA-Z0-9_-]+)?$": {
+          "type": "string",
+          "description": "Case sensitive translation key. May only contain letters, numbers, underscores, and hyphens."
+        }
+      },
+      "additionalProperties": false
+    }
+  },
+  "additionalProperties": false
+}

+ 19 - 0
.vscode/settings.json

@@ -12,6 +12,25 @@
   },
   "editor.tabSize": 2,
 
+  "json.schemas": [
+    {
+      "fileMatch": ["**/locales.json"],
+      "url": ".vscode/schemas/locales.schema.json"
+    },
+    {
+      "fileMatch": ["**/require.json"],
+      "url": ".vscode/schemas/require.schema.json"
+    },
+    {
+      "fileMatch": ["**/resources.json"],
+      "url": ".vscode/schemas/resources.schema.json"
+    },
+    {
+      "fileMatch": ["**/translations/*-*.json"],
+      "url": ".vscode/schemas/translation.schema.json"
+    },
+  ],
+
   // requires extension: fabiospampinato.vscode-highlight
   "highlight.regexes": {
     "(TODO(\\((\\s|\\d|\\w|[,.-_+*&])+\\))?:?)": { // TODO: or TODO or TODO(xy): but not todo or todo:

+ 6 - 2
assets/resources.json

@@ -12,10 +12,14 @@
     "css-hide_themesong_logo": "style/hideThemeSongLogo.css",
     "css-show_votes": "style/showVotes.css",
     "css-vol_slider_size": "style/volSliderSize.css",
+    "doc-changelog": {
+      "path": "/changelog.md",
+      "ref": "main",
+      "integrity": false
+    },
     "doc-license": {
       "path": "/LICENSE.txt",
-      "ref": "$BRANCH",
-      "integrity": false
+      "ref": "$BRANCH"
     },
     "font-cousine_ttf": "fonts/Cousine/Cousine-Regular.ttf",
     "font-cousine_woff": "fonts/Cousine/Cousine-Regular.woff",