Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed `moveCells` behaviour when moving part of a range. (#479)
- Fixed `moveColumns`/`moveRows` inconsistent behaviour. (#479)
- Fixed undo of `moveColumns`/`moveRows` operations. (#479)
- Fixed name-collision issue in translations.

## [0.1.3] - 2020-07-21

Expand Down
1 change: 0 additions & 1 deletion docs/guide/built-in-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ lets you design your own [custom functions](custom-functions).
| COUNTUNIQUE | Math and trigonometry | Counts the number of unique values in a list of specified values and ranges. | COUNTUNIQUE(Value1, [Value2, ...]) |
| DECIMAL | Math and trigonometry | Converts text with characters from a number system to a positive integer in the base radix given. | DECIMAL("Text"; Radix) |
| DEGREES | Math and trigonometry | Converts radians into degrees. | DEGREES(Number) |
| E | Math and trigonometry | Returns 2.718281828459..., the value of the mathematical constant E to as many decimal places as set in configuration | E() |
| EVEN | Math and trigonometry | Rounds a positive number up to the next even integer and a negative number down to the next even integer. | EVEN(Number) |
| EXP | Math and trigonometry | Returns e raised to the power of a number. | EXP(Number) |
| INT | Math and trigonometry | Rounds a number down to the nearest integer. | INT(Number) |
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/csCZ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'DECIMAL',
DEGREES: 'DEGREES',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'EOMONTH',
ERF: 'ERF',
ERFC: 'ERFC',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/daDK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'DECIMAL',
DEGREES: 'GRADER',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'SLUT.PÅ.MÅNED',
ERF: 'FEJLFUNK',
ERFC: 'FEJLFUNK.KOMP',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/deDE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'DEZIMAL',
DEGREES: 'GRAD',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'MONATSENDE',
ERF: 'GAUSSFEHLER',
ERFC: 'GAUSSFKOMPL',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/enGB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'DECIMAL',
DEGREES: 'DEGREES',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'EOMONTH',
ERF: 'ERF',
ERFC: 'ERFC',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/esES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export const dictionary: RawTranslationPackage = {
DECIMAL: 'CONV.DECIMAL',
DEGREES: 'GRADOS',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'FIN.MES',
ERF: 'FUN.ERROR',
ERFC: 'FUN.ERROR.COMPL',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/fiFI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'DESIMAALI',
DEGREES: 'ASTEET',
DELTA: 'SAMA.ARVO',
E: 'E',
EOMONTH: 'KUUKAUSI.LOPPU',
ERF: 'VIRHEFUNKTIO',
ERFC: 'VIRHEFUNKTIO.KOMPLEMENTTI',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/frFR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'DECIMAL',
DEGREES: 'DEGRES',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'FIN.MOIS',
ERF: 'ERF',
ERFC: 'ERFC',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/huHU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'TIZEDES',
DEGREES: 'FOK',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'HÓNAP.UTOLSÓ.NAP',
ERF: 'HIBAF',
ERFC: 'HIBAF.KOMPLEMENTER',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/itIT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'DECIMALE',
DEGREES: 'GRADI',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'FINE.MESE',
ERF: 'FUNZ.ERRORE',
ERFC: 'FUNZ.ERRORE.COMP',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/nbNO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'DESIMAL',
DEGREES: 'GRADER',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'MÅNEDSSLUTT',
ERF: 'FEILF',
ERFC: 'FEILFK',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/nlNL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'DECIMAAL',
DEGREES: 'GRADEN',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'LAATSTE.DAG',
ERF: 'FOUTFUNCTIE',
ERFC: 'FOUT.COMPLEMENT',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/plPL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'DZIESIĘTNA',
DEGREES: 'STOPNIE',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'NR.SER.OST.DN.MIEŚ',
ERF: 'FUNKCJA.BŁ',
ERFC: 'KOMP.FUNKCJA.BŁ',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/ptPT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'DECIMAL',
DEGREES: 'GRAUS',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'FIMMÊS',
ERF: 'FUNERRO',
ERFC: 'FUNERROCOMPL',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/ruRU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'ДЕС',
DEGREES: 'ГРАДУСЫ',
DELTA: 'ДЕЛЬТА',
E: 'E',
EOMONTH: 'КОНМЕСЯЦА',
ERF: 'ФОШ',
ERFC: 'ДФОШ',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/svSE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'DECIMAL',
DEGREES: 'GRADER',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'SLUTMÅNAD',
ERF: 'FELF',
ERFC: 'FELFK',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/languages/trTR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const dictionary: RawTranslationPackage = {
DECIMAL: 'ONDALIK',
DEGREES: 'DERECE',
DELTA: 'DELTA',
E: 'E',
EOMONTH: 'SERİAY',
ERF: 'HATAİŞLEV',
ERFC: 'TÜMHATAİŞLEV',
Expand Down
11 changes: 0 additions & 11 deletions src/interpreter/plugin/MathConstantsPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,18 @@ import {ProcedureAst} from '../../parser'
import {FunctionPlugin} from './FunctionPlugin'

const PI = parseFloat(Math.PI.toFixed(14))
const E = parseFloat(Math.E.toFixed(14))

export class MathConstantsPlugin extends FunctionPlugin {
public static implementedFunctions = {
'PI': {
method: 'pi',
parameters: [],
},
'E': {
method: 'e',
parameters: [],
},
}

public pi(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
return this.runFunction(ast.args, formulaAddress, this.metadata('PI'),
() => PI
)
}

public e(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
return this.runFunction(ast.args, formulaAddress, this.metadata('E'),
() => E
)
}
}
10 changes: 10 additions & 0 deletions test/i18n.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ describe('i18n', () => {
})
})

it('functions should have unique names in a single language', () => {
allLanguages.forEach(lang => {
const names = Object.values(lang.functions)
names.sort()
for(let i=0;i<names.length-1;i++) {
expect(names[i]).not.toEqual(names[i+1])
}
})
})

it('translation package sanitization', () => {
// eslint-disable-next-line
// @ts-ignore
Expand Down
19 changes: 0 additions & 19 deletions test/interpreter/function-e.spec.ts

This file was deleted.