« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/language.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things/language.js')
-rw-r--r--src/data/things/language.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/data/things/language.js b/src/data/things/language.js
index afa9f1e..a325d6a 100644
--- a/src/data/things/language.js
+++ b/src/data/things/language.js
@@ -1,16 +1,16 @@
-import Thing from './thing.js';
-
 import {Tag} from '#html';
 import {isLanguageCode} from '#validators';
 
 import CacheableObject from './cacheable-object.js';
 
+import Thing, {
+  externalFunction,
+  flag,
+  simpleString,
+} from './thing.js';
+
 export class Language extends Thing {
-  static [Thing.getPropertyDescriptors] = ({
-    validators: {
-      isLanguageCode,
-    },
-  }) => ({
+  static [Thing.getPropertyDescriptors] = () => ({
     // Update & expose
 
     // General language code. This is used to identify the language distinctly
@@ -23,7 +23,7 @@ export class Language extends Thing {
 
     // Human-readable name. This should be the language's own native name, not
     // localized to any other language.
-    name: Thing.common.simpleString(),
+    name: simpleString(),
 
     // Language code specific to JavaScript's Internationalization (Intl) API.
     // Usually this will be the same as the language's general code, but it
@@ -45,7 +45,7 @@ export class Language extends Thing {
     // with languages that are currently in development and not ready for
     // formal release, or which are just kept hidden as "experimental zones"
     // for wiki development or content testing.
-    hidden: Thing.common.flag(false),
+    hidden: flag(false),
 
     // Mapping of translation keys to values (strings). Generally, don't
     // access this object directly - use methods instead.
@@ -73,7 +73,7 @@ export class Language extends Thing {
 
     // Update only
 
-    escapeHTML: Thing.common.externalFunction({expose: true}),
+    escapeHTML: externalFunction(),
 
     // Expose only
 
@@ -192,7 +192,7 @@ export class Language extends Thing {
   // html.Tag objects, which are treated as sanitized by default (so that they
   // can be nested inside strings at all).
   #sanitizeStringArg(arg) {
-    const escapeHTML = this.escapeHTML;
+    const escapeHTML = CacheableObject.getUpdateValue(this, 'escapeHTML');
 
     if (!escapeHTML) {
       throw new Error(`escapeHTML unavailable`);
@@ -224,7 +224,7 @@ export class Language extends Thing {
   // contents of a slot directly, it should be manually sanitized with this
   // function first.
   sanitize(arg) {
-    const escapeHTML = this.escapeHTML;
+    const escapeHTML = CacheableObject.getUpdateValue(this, 'escapeHTML');
 
     if (!escapeHTML) {
       throw new Error(`escapeHTML unavailable`);