Skip to content

Commit

Permalink
translate definition file in english
Browse files Browse the repository at this point in the history
add a test to make sure labels are consistent in both fr and en files, fix some issues in both definition files

closes #1135
  • Loading branch information
kaligrafy committed Dec 16, 2024
1 parent 3108593 commit 68f6690
Show file tree
Hide file tree
Showing 17 changed files with 2,013 additions and 529 deletions.
4 changes: 3 additions & 1 deletion packages/chaire-lib-backend/src/config/server.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,9 @@ export const setProjectConfiguration = (newConfig: Partial<ProjectConfiguration<
engines: {
osrmRouting: {
port: osrmModesInDeprecatedFormat[osrmMode].port,
host: osrmModesInDeprecatedFormat[osrmMode].host || osrmModesInDeprecatedFormat[osrmMode].osrmPath,
host:
osrmModesInDeprecatedFormat[osrmMode].host ||
osrmModesInDeprecatedFormat[osrmMode].osrmPath,
autoStart: osrmModesInDeprecatedFormat[osrmMode].autoStart,
enabled: osrmModesInDeprecatedFormat[osrmMode].enabled
}
Expand Down
83 changes: 83 additions & 0 deletions packages/transition-backend/file/__tests__/definitions.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import fs from 'fs';
describe('LaTeX Label Consistency Tests', () => {
// Helper function to extract labels from LaTeX content
function extractLabels(content) {
const labelRegex = /\\label{([^}]+)}/g;
const labels = new Set();
let match;

while ((match = labelRegex.exec(content)) !== null) {
labels.add(match[1]);
}

return labels;
}

// Read both files before all tests
let enContent;
let frContent;
let enLabels;
let frLabels;

beforeAll(() => {
enContent = fs.readFileSync('file/definitions/definitions-en.tex', 'utf8');
frContent = fs.readFileSync('file/definitions/definitions-fr.tex', 'utf8');
enLabels = extractLabels(enContent);
frLabels = extractLabels(frContent);
});

test('all English labels exist in French file', () => {
const missingInFr = [...enLabels].filter((label) => !frLabels.has(label));
expect(missingInFr).toEqual([]);
});

test('all French labels exist in English file', () => {
const missingInEn = [...frLabels].filter((label) => !enLabels.has(label));
expect(missingInEn).toEqual([]);
});

test('both files have the same number of labels', () => {
expect(enLabels.size).toBe(frLabels.size);
});

test('labels appear in the same order in both files', () => {
const enLabelArray = [...enLabels];
const frLabelArray = [...frLabels];

expect(enLabelArray).toEqual(frLabelArray);
});

test('no duplicate labels in English file', () => {
const duplicates = new Set();
const seen = new Set();
const labelRegex = /\\label{([^}]+)}/g;
let match;

while ((match = labelRegex.exec(enContent)) !== null) {
const label = match[1];
if (seen.has(label)) {
duplicates.add(label);
}
seen.add(label);
}

expect([...duplicates]).toEqual([]);
});

test('no duplicate labels in French file', () => {
const duplicates = new Set();
const seen = new Set();
const labelRegex = /\\label{([^}]+)}/g;
let match;

while ((match = labelRegex.exec(frContent)) !== null) {
const label = match[1];
if (seen.has(label)) {
duplicates.add(label);
}
seen.add(label);
}

expect([...duplicates]).toEqual([]);
});
});
2 changes: 2 additions & 0 deletions packages/transition-backend/file/definitions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ When adding or modifying information on these files, they must follow the alread
\makecell[r]{Title} & \[Symbol\] & \[Unit\] & \[Expression\] & Description \\
\hline
```
After any edit, make sure labels are consistent in both files. For this, run `yarn workspace transition-backend test definitions`.

Each row is starts with a label that allows for it to be located by the tooltip component and ends with `\hline`. Each cell is separated with `&`, and starts and ends with a space. The unit and expression can be empty, in which case they must be represented by a single hyphen (`-`). The symbol, unit, and expression are mathematical expressions, and must be start `\[` and end with `\]`, unless they are empty. Finally, any change must be translated and added to both the French and English file.
455 changes: 455 additions & 0 deletions packages/transition-backend/file/definitions/definitions-en.aux

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Fdb version 4
["pdflatex"] 1734383786.35379 "/Users/admin/ws/transition-fork/packages/transition-backend/file/definitions/definitions-en.tex" "definitions-en.pdf" "definitions-en" 1734383787.45612 0
"/Users/admin/ws/transition-fork/packages/transition-backend/file/definitions/definitions-en.tex" 1734383786.14859 91651 1e6d0f7e5a8a32cd7ed6020d1dd5471b ""
"/usr/local/texlive/2024/texmf-dist/fonts/map/fontname/texfonts.map" 1577235249 3524 cb3e574dea2d1052e39280babc910dc8 ""
"/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/cmextra/cmex7.tfm" 1246382020 1004 54797486969f23fa377b128694d548df ""
"/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmbx12.tfm" 1136768653 1324 c910af8c371558dc20f2d7822f66fe64 ""
"/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmr12.tfm" 1136768653 1288 655e228510b4c2a1abe905c368440826 ""
"/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb" 1248133631 32080 340ef9bf63678554ee606688e7b5339d ""
"/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmex10.pfb" 1248133631 30251 6afa5cb1d0204815a708a080681d4674 ""
"/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb" 1248133631 36299 5f9df58c2139e7edcf37c8fca4bd384d ""
"/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi5.pfb" 1248133631 37912 77d683123f92148345f3fc36a38d9ab1 ""
"/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb" 1248133631 36281 c355509802a035cadc5f15869451dcee ""
"/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb" 1248133631 35752 024fb6c41858982481f6968b5fc26508 ""
"/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmr5.pfb" 1248133631 31809 8670ca339bf94e56da1fc21c80635e2a ""
"/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb" 1248133631 32762 224316ccc9ad3ca0423a14971cfa7fc1 ""
"/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb" 1248133631 32569 5e5ddc8df908dea60932f3c484a54c0d ""
"/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy5.pfb" 1248133631 32915 7bf7720c61a5b3a7ff25b0964421c9b6 ""
"/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy7.pfb" 1248133631 32716 08e384dc442464e7285e891af9f45947 ""
"/usr/local/texlive/2024/texmf-dist/tex/context/base/mkii/supp-pdf.mkii" 1461363279 71627 94eb9990bed73c364d7f53f960cc8c5b ""
"/usr/local/texlive/2024/texmf-dist/tex/generic/atbegshi/atbegshi.sty" 1575674566 24708 5584a51a7101caf7e6bbf1fc27d8f7b1 ""
"/usr/local/texlive/2024/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty" 1576625341 40635 c40361e206be584d448876bba8a64a3b ""
"/usr/local/texlive/2024/texmf-dist/tex/generic/bitset/bitset.sty" 1576016050 33961 6b5c75130e435b2bfdb9f480a09a39f9 ""
"/usr/local/texlive/2024/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty" 1576625223 8371 9d55b8bd010bc717624922fb3477d92e ""
"/usr/local/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty" 1644112042 7237 bdd120a32c8fdb4b433cf9ca2e7cd98a ""
"/usr/local/texlive/2024/texmf-dist/tex/generic/iftex/ifvtex.sty" 1572645307 1057 525c2192b5febbd8c1f662c9468335bb ""
"/usr/local/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty" 1575499628 8356 7bbb2c2373aa810be568c29e333da8ed ""
"/usr/local/texlive/2024/texmf-dist/tex/generic/intcalc/intcalc.sty" 1576625065 31769 002a487f55041f8e805cfbf6385ffd97 ""
"/usr/local/texlive/2024/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty" 1576878844 5412 d5a2436094cd7be85769db90f29250a6 ""
"/usr/local/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty" 1701727651 17865 1a9bd36b4f98178fa551aca822290953 ""
"/usr/local/texlive/2024/texmf-dist/tex/generic/pdfescape/pdfescape.sty" 1576015897 19007 15924f7228aca6c6d184b115f4baa231 ""
"/usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty" 1593379760 20089 80423eac55aa175305d35b49e04fe23b ""
"/usr/local/texlive/2024/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty" 1576624663 7008 f92eaa0a3872ed622bbf538217cd2ab7 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty" 1686341992 2222 499d61426192c39efd8f410ee1a52b9c ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty" 1686341992 4173 82ac04dfb1256038fad068287fbb4fe6 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty" 1686341992 88371 d84032c0f422c3d1e282266c01bef237 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty" 1686341992 4474 b811654f4bf125f11506d13d13647efb ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty" 1686341992 2444 0d0c1ee65478277e8015d65b86983da2 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/atveryend/atveryend.sty" 1576191570 19336 ce7ae9438967282886b3b036cfad1e4d ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/auxhook/auxhook.sty" 1576625391 3935 57aa3c3e203a5c2effb4d2bd2efbc323 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls" 1705352648 20144 147463a6a579f4597269ef9565205cfe ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/base/atbegshi-ltx.sty" 1705352648 3045 273c666a54e60b9f730964f431a56c1b ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/base/atveryend-ltx.sty" 1705352648 2462 6bc53756156dbd71c1ad550d30a3b93f ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/base/inputenc.sty" 1705352648 5048 425739d70251273bf93e3d51f3c40048 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo" 1705352648 8448 dbc0dbf4156c0bb9ba01a1c685d3bad0 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty" 1601931149 46845 3b58f70c6e861a13d927bff09d35ecbc ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/geometry/geometry.sty" 1578002852 41601 9cf6c5257b1bc7af01a58859749dd37a ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg" 1459978653 1213 620bba36b25224fa9b7e1ccb4ecb76fd ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg" 1465944070 1224 978390e9c2234eab29404bc21b268d1e ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/pdftex.def" 1663965824 19448 1e988b341dda20961a6b931bcde55519 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/color.sty" 1654720880 7233 e46ce9241d2b2ca2a78155475fdd557a ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphics.sty" 1654720880 18387 8f900a490197ebaf93c02ae9476d4b09 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphicx.sty" 1654720880 8010 a8d949cbdbc5c983593827c9eec252e1 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty" 1654720880 2671 7e67d78d9b88c845599a85b2d41f2e39 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx" 1667332637 2885 9c645d672ae17285bba324998918efd8 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/trig.sty" 1654720880 4023 293ea1c16429fc0c4cf605f4da1791a9 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/hycolor/hycolor.sty" 1580250785 17914 4c28a13fc3d975e6e81c9bea1d697276 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hpdftex.def" 1705871765 48154 e46bf8adeb936500541441171d61726d ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hyperref.sty" 1705871765 220920 fd3cbb5f1a2bc9b8f451b8b7d8171264 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/nameref.sty" 1705871765 11026 182c63f139a71afd30a28e5f1ed2cd1c ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def" 1705871765 14249 e67cb186717b7ab18d14a4875e7e98b5 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def" 1705871765 117112 05831178ece2cad4d9629dcf65099b11 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/hyphenat/hyphenat.sty" 1252025529 5798 0437b031e663035b68539cf7ac7c8eeb ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty" 1655478651 22555 6d8e155cfef6d82c3d5c742fea7c992e ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty" 1665067230 13815 760b0c02f691ea230f5359c4e1de23a7 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def" 1708463273 30006 3d512c0edd558928ddea1690180ef77e ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/makecell/makecell.sty" 1249334690 15773 2dd7dde1ec1c2a3d0c85bc3b273e04d8 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mathtools.sty" 1710187076 62672 9ff036bc89365461cc2bd482cc1e4879 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mhsetup.sty" 1616101747 5582 a43dedf8e5ec418356f1e9dfe5d29fc3 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/multirow/multirow.sty" 1615845910 6149 2398eec4faa1ee24ff761581e580ecf1 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/refcount/refcount.sty" 1576624809 9878 9e94e8fa600d95f9c7731bb21dfb67a4 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty" 1657483315 9714 ba3194bd52c8499b3f1e3eb91d409670 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/tabulary/tabulary.sty" 1403566480 13791 8c83287d79183c3bf58fd70871e8a70b ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/tools/array.sty" 1698869629 12667 e4b5eb11e4b7239e6c8a52bbe074a6c6 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/tools/calc.sty" 1698869629 10214 547fd4d29642cb7c80bf54b49d447f01 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/tools/longtable.sty" 1698955022 12935 94a3291359b5f73ff1b19345a6983105 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/tools/tabularx.sty" 1698869629 7147 d45559f8a31b8c53ada0640516660003 ""
"/usr/local/texlive/2024/texmf-dist/tex/latex/url/url.sty" 1388531844 12796 8edb7d69a20b857904dd0ea757c14ec9 ""
"/usr/local/texlive/2024/texmf-dist/web2c/texmf.cnf" 1708706663 41649 5d6ae549fbbcb850a863f69aa41f3d10 ""
"/usr/local/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map" 1734379952.75025 5467645 128b85b7cde5f5edc5cb7f1dd7ff8736 ""
"/usr/local/texlive/2024/texmf-var/web2c/pdftex/pdflatex.fmt" 1734379943 8221433 003ffa9d33df4adbdada298ec51bd3ec ""
"/usr/local/texlive/2024/texmf.cnf" 1710266656 577 e590dabc9e28c5b61546e15f63eebcdf ""
"definitions-en.aux" 1734383787.38471 31898 c42a736679d3a90ac763cf78e559957c "pdflatex"
"definitions-en.out" 1734383786.88811 0 d41d8cd98f00b204e9800998ecf8427e "pdflatex"
"definitions-en.tex" 1734383786.14859 91651 1e6d0f7e5a8a32cd7ed6020d1dd5471b ""
(generated)
"definitions-en.aux"
"definitions-en.log"
"definitions-en.out"
"definitions-en.pdf"
(rewritten before read)
Loading

0 comments on commit 68f6690

Please sign in to comment.