//~OPTIONS
{
  include: ["fcf:NSystem/languages.js"],
  access:  ["root"],
}

//~ARGUMENTS
{
  defaultLanguage: fcf.argProg(),
  byPrefix:        fcf.argProg(),
  byCookie:        fcf.argProg(),
  byParameter:     fcf.argProg(),
  parameter:       fcf.argProg(),
  byHTTP:          fcf.argProg(),
  languages:       fcf.argProg(),
}

//~TEMPLATE
%{{
  var languages    = fcf.application.getSystemVariable("fcf:languages");
  var allLanguages = fcf.NTools.languages.getAllLanguages();
}}%

<h4>!{{Available languages}}!:</h4>
@{{
  render.template("@controls:multiselect", {
                  fcfAlias: "languages",
                  data:     fcf.argRef(args.fcfId, "languages"),
                  items:    allLanguages,
                  blank: false,
                  });
}}@

<h4>!{{Default language}}!:</h4>

@{{
  render.template({
    template: "@controls:select",
    args: {
      value: fcf.argRef(args.fcfId, "defaultLanguage"),
      items: fcf.argRef(args.fcfId, "languages"),
      blank: false,
    }
  })
}}@
<h4>!{{Method for determining the user's language}}!:</h4>
<p>
@{{ render.template("@controls:checkbox", { title: fcf.t("By URL prefix"), value: fcf.argRef(args.fcfId, "byPrefix")}) }}@
</p>
<p>
@{{ render.template("@controls:checkbox", { title: fcf.t("By URL parameter"), value: fcf.argRef(args.fcfId, "byParameter")}) }}@
</p>
<p>
!{{URL parameter:}}!@{{ render.template("@controls:text-edit", { value: fcf.argRef(args.fcfId, "parameter")}) }}@
</p>
<p>
@{{ render.template("@controls:checkbox", { title: fcf.t("By cookie parameter"), value: fcf.argRef(args.fcfId, "byCookie")}) }}@
</p>
<p>
@{{ render.template("@controls:checkbox", { title: fcf.t("By HTTP header"), value: fcf.argRef(args.fcfId, "byHTTP")}) }}@
</p>

@{{ render.template("@controls:button", {fcfAlias: "save",   title: fcf.t("Save"),   enable: false, fcfEventClick: "parent.onSave()" })}}@
@{{ render.template("@controls:button", {fcfAlias: "cancel", title: fcf.t("Cancel"), enable: false, fcfEventClick: "parent.onCancel()" })}}@
