add a configuration variable
authorLaurent Mazet <mazet@softndesign.org>
Tue, 11 Aug 2026 19:31:01 +0000 (21:31 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Tue, 11 Aug 2026 19:31:01 +0000 (21:31 +0200)
README.md
public/config.js.sample
public/trivabble.js

index 3750e12269b4db2a806b9c86176935287e4523ac..03e0564e671cad7a4031865d18dea81650a657df 100644 (file)
--- a/README.md
+++ b/README.md
@@ -288,6 +288,10 @@ Once dictionaries have been build, script 'dict-dists-extractor/make_optimized_b
   Calculus 'floor((N - 15) / 10))' defines an index to choose parameter 'p' from set '{0.8 0.7 0.65 0.6}'.
   Letter value is defined by 'min(floor(1 + 9 ceil(r^p) * 100), 10)'
 
+By default, optimized bags are not presented in the bag selector. To activate
+this functionality, OPTIMIZED_LANGUAGE_BAG must be set to true in configuration
+file.
+
 ### Credits
 
 Thanks [Laurent Mazet](http://www.softndesign.org/~mazet/) for many contributions.
index e06bc0d05603b280aa6970a17c5f5a61f7b374fb..690541095982faf155b0130b7d03ee7eab72338d 100644 (file)
@@ -59,6 +59,9 @@ window.TrivabbleConf = {
     // Enable custom board definitions
     //ENABLE_CUSTOM_BOARD: false,
 
+    // Enable optimized language bags
+    //OPTIMIZED_LANGUAGE_BAG: false,
+
     // I don't like trailing commas, here is a nice message for you reading this file :-)
     HAVE_FUN: true
 };
index b3d65f4d5a7962e7f1e4cae9726bac91333f3e05..78482337bb4a68b677d8cf042dd513bb3ba74368 100644 (file)
@@ -67,6 +67,7 @@
     setConf("ENABLE_TIMER",          false);
     setConf("CELL_CAPTIONS",         "dots"); // "clip", "dots", "none", "short"
     setConf("ENABLE_CUSTOM_BOARD",   false);
+    setConf("OPTIMIZED_LANGUAGE_BAG",false);
 
     function isSetting(key) {
         return Object.prototype.hasOwnProperty.call(Conf, key) ||
         boardLangSelect.textContent = "";
 
         for (const key of Object.keys(availableBoardLangs)) {
-            boardLangSelect.add(new Option(_(availableBoardLangs[key]), key));
+            if (getSetting("OPTIMIZED_LANGUAGE_BAG") || !/-opt/.test(key)) {
+                boardLangSelect.add(new Option(_(availableBoardLangs[key]), key));
+            }
         }
 
         Array.prototype.sort.call(boardLangSelect.options, function (a, b) {