nicolaskruchten / pivottable

Open-source Javascript Pivot Table (aka Pivot Grid, Pivot Chart, Cross-Tab) implementation with drag'n'drop.
https://pivottable.js.org/
MIT License
4.36k stars 1.07k forks source link

New local #1339

Open skkrist opened 1 year ago

skkrist commented 1 year ago

Is it possible to add a pivot.no.coffee into the package?

pivot.no.coffee:

callWithJQuery = (pivotModule) -> if typeof exports is "object" and typeof module is "object" # CommonJS pivotModule require("jquery") else if typeof define is "function" and define.amd # AMD define ["jquery"], pivotModule

Plain browser env

else
    pivotModule jQuery

callWithJQuery ($) -> nf = $.pivotUtilities.numberFormat tpl = $.pivotUtilities.aggregatorTemplates

noFmt =    nf(thousandsSep: " ", decimalSep: ",")
noFmtInt = nf(digitsAfterDecimal: 0, thousandsSep: " ", decimalSep: ",")
noFmtPct = nf(digitsAfterDecimal: 1, scaler: 100, suffix: "%", thousandsSep: " ", decimalSep: ",")

$.pivotUtilities.locales.no =
    localeStrings:
        renderError: "En feil oppstod ved visning av pivot tabellen."
        computeError: "En feil oppstod under beregning av pivot tabellen."
        uiRenderError: "En feil oppstod ved visning av PivotTable UI."
        selectAll: "Velg alle"
        selectNone: "Velg ingen"
        tooMany: "(for mange verdier å vise)"
        filterResults: "Filtrer verdier"
        totals: "Total"
        vs: "vs"
        by: "av"
        apply: "Bruk"
        cancel: "Annuler"

    aggregators:
        "Antall":                             tpl.count(noFmtInt)
        "Antall unike verdier":               tpl.countUnique(noFmtInt)
        "Liste unike verdier":                tpl.listUnique(", ")
        "Sum":                                tpl.sum(noFmt)
        "Sum i heltall":                      tpl.sum(noFmtInt)
        "Median":                             tpl.median(noFmt)
        "Gjennomsnitt":                       tpl.average(noFmt)
        "Standardavvik":                      tpl.stdev(1, noFmt)
        "Minimum":                            tpl.min(noFmt)
        "Maximum":                            tpl.max(noFmt)
        "Andel av totalen":                   tpl.fractionOf(tpl.count(), "total", noFmtPct)
        "Andel av raden":                     tpl.fractionOf(tpl.count(), "row",   noFmtPct)
        "Andel av kolonnen":                  tpl.fractionOf(tpl.count(), "col",   noFmtPct)

    renderers:
        "Tabell":                          $.pivotUtilities.renderers["Table"]
        "Tabell med søyler":               $.pivotUtilities.renderers["Table Barchart"]
        "Heatmap":                         $.pivotUtilities.renderers["Heatmap"]
        "Heatmap per rad":                 $.pivotUtilities.renderers["Row Heatmap"]
        "Heatmap per kolonne":             $.pivotUtilities.renderers["Col Heatmap"]
skkrist commented 1 year ago

@nicolaskruchten Hi, is it possible to add the norwegian set-up as a new local as commented above?

It would be particulary useful to have the correct format (thousand separator, decimal etc)- I have a shiny application where I use a download button to get pivot table content as a csv-file. Excel is set up with european /norwegian format, so it would be nice to have same format in the pivot-file.