Home /Modules/languages/SLLanguageCatalog.sleela

SLLanguageCatalog.sleela

lib/languages/SLLanguageCatalog.sleela · 70 line(s) · sleela

<< lib/languages/SLLanguageCatalog.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines the SLeeLa standard-library type SLLanguageCatalog used within the languages library family. >>
#sleela 2.5
material;
< Unified SLeeLa standard-library front-end object. >
< Family: languages. The catalog of available language packs. A program selects >
< the active locale with use(code); text(key) then returns the translation in >
< that language, falling back to English when a key or pack is unavailable. The >
< available packs mirror the repository's /languages folder (en, es, fr, de, >
< pt, it, ja, zh, hi, ko, th, ar). The runnable, data-bearing build is >
< lib/languages/languages.sleela, which carries the translations inline so a >
< program can present localized output without a separate file parser. >
class SLLanguageCatalog {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 10065;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-04";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 9;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }
  < active locale code (default "en") >
  String active;

  void use(String code) { active = code; }
  String current() { if (active == "") { return "en"; } return active; }

  < The set of locales shipped under /languages, as a stable count + probe. >
  int localeCount() { return 12; }
  boolean has(String code) {
    return code == "en" || code == "es" || code == "fr" || code == "de"
        || code == "pt" || code == "it" || code == "ja" || code == "zh"
        || code == "hi" || code == "ko" || code == "th" || code == "ar";
  }
}