Files
wekan/tests/malagasyTranslationProgress.test.cjs
T
Lauri Ojansivu 86652c8718 Ask for the columns of a CSV or Excel import, apply Owner, and import WeKan's own Excel export.
A CSV, TSV or Excel import now shows which column is which card field
before importing, pre-filled from the header names - English names and
WeKan's own export column names in every language - and asks for what is
missing: a file with no list column gets one list, named on the page,
instead of one list per row. Unused columns can be kept as text custom
fields. The choice goes to the server as csvMapping, checked before
anything is written, and the REST import and api.py take one too.

The Owner column is applied, as are swimlane, received date, parent card,
spent time, overtime and archived. A TSV value containing a comma stays one
value. A dropdown custom field value that is not one of its items is skipped
instead of failing the import.

An Excel workbook is read sheet by sheet, its header found in row 1 or where
WeKan's export puts it, in any language; formula cells are read as their
results and rich text as text. WeKan's own Excel export imports, and a
workbook with many boards - each on its own sheet, as Export all boards
writes it - imports as many boards; the Activity sheet is skipped.

Thanks to xet7 !
2026-10-09 12:52:21 +03:00

339 lines
18 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// The completed catalog predates newer features; keep its no-regression gate.
// Full translation work remains visible through fill-translations.mjs --list.
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const { spawnSync } = require('node:child_process');
const root = path.resolve(__dirname, '..');
const fillScript = path.join(root, 'releases/translations/fill-translations.mjs');
const result = spawnSync(process.execPath, [fillScript, '--completed-catalog', '--list', 'mg'], {
cwd: root,
encoding: 'utf8',
});
assert.equal(result.status, 0, result.stderr);
const remaining = JSON.parse(result.stdout);
assert.equal(Object.keys(remaining).length, 0);
const english = JSON.parse(fs.readFileSync(
path.join(root, 'imports/i18n/data/en.i18n.json'), 'utf8'));
const malagasy = JSON.parse(fs.readFileSync(
path.join(root, 'imports/i18n/data/mg.i18n.json'), 'utf8'));
const tokens = (value) => [...value.matchAll(
/__[A-Za-z0-9_]+__|%[A-Za-z]|%{[A-Za-z0-9]+}|{{[A-Za-z0-9]+}}/g)]
.map(([token]) => token).sort();
const tags = (value) => [...value.matchAll(/<\/?[A-Za-z][^>]*>/g)]
.map(([tag]) => tag).sort();
for (const [key, value] of Object.entries(malagasy)) {
if (value !== english[key]) {
assert.deepEqual(tokens(value), tokens(english[key]), key);
}
assert.deepEqual(tags(value), tags(english[key]), key);
}
assert.equal(malagasy.accept, 'Ekeo');
assert.deepEqual(tokens(malagasy['activity-changedTitle']), ['%s', '%s']);
assert.deepEqual(tokens(malagasy['act-deleteCard']),
['__board__', '__card__', '__list__', '__swimlane__']);
assert.match(malagasy['board-members-same-org-only'], /fikambanana/);
assert.match(malagasy['board-members-same-team-only'], /ekipa/);
assert.deepEqual(tokens(malagasy['due-date-changed-times']), ['%s']);
assert.deepEqual(tokens(malagasy['act-removeChecklistItem']),
['__board__', '__card__', '__checkList__', '__checklistItem__', '__list__',
'__swimlane__']);
assert.match(malagasy['act-addAttachment'], /rakitra/);
assert.match(malagasy['act-addChecklist'], /lisitra fanamarinana/);
assert.match(malagasy['act-createCustomField'], /saha namboarina/);
assert.match(malagasy['act-archivedBoard'], /arisiva/);
assert.deepEqual(tokens(malagasy['act-moveCardToOtherBoard']),
['__board__', '__card__', '__list__', '__oldBoard__', '__oldList__',
'__oldSwimlane__', '__swimlane__']);
assert.deepEqual(tokens(malagasy['activity-imported']), ['%s', '%s', '%s']);
assert.deepEqual(tokens(malagasy['activity-checklist-completed-card']),
['__board__', '__card__', '__checklist__', '__list__', '__swimlane__']);
assert.equal(malagasy['allboards.workspaces'], 'Toeram-piasana');
assert.match(malagasy['allboards.edit-workspace-icon'], /markdown/);
assert.equal(malagasy['workspaceActionsPopup-title'],
'Fikirana toeram-piasana');
assert.deepEqual(tokens(malagasy['activity-dueDate']), ['%s', '%s']);
assert.match(malagasy['list-width-error-message'], /isa feno farafahakeliny 200 piksel/);
assert.doesNotMatch(malagasy['list-width-error-message'], /270/);
assert.match(malagasy['set-list-width-value'], /piksel/);
assert.match(malagasy['set-swimlane-height-value'], /piksel/);
assert.equal(malagasy['add-checklist'], 'Ampio lisitra fanamarinana');
assert.deepEqual(tokens(malagasy['and-n-other-card']), ['__count__']);
assert.deepEqual(tokens(malagasy['and-n-other-card_plural']), ['__count__']);
assert.deepEqual(tokens(malagasy['avatar-too-big']), ['__size__']);
assert.match(malagasy['board-background-image-url'], /URL/);
assert.deepEqual(tokens(malagasy['board-nb-stars']), ['%s']);
assert.deepEqual(tags(malagasy['board-private-info']),
['</strong>', '<strong>']);
assert.deepEqual(tags(malagasy['board-public-info']),
['</strong>', '<strong>']);
assert.deepEqual(tokens(
malagasy['board-open-and-move-between-remaining-and-workspaces']),
['__workspaces__']);
assert.match(malagasy['enter-zoom-level'], /50-300%/);
assert.deepEqual(tokens(malagasy['card-comments-title']), ['%s']);
assert.equal(malagasy['card-edit-custom-fields'],
'Ovay ny saha namboarina');
assert.match(malagasy['cardStartPlanningPokerPopup-title'], /Planning Poker/);
assert.match(malagasy['editPokerEndDatePopup-title'], /Planning Poker/);
assert.equal(malagasy['importDependenciesPopup-title'],
'Manafatra fiankinana');
assert.equal(malagasy['exportChecklistPopup-title'],
'Manondrana lisitra fanamarinana');
assert.equal(malagasy['importSwimlanePopup-title'], 'Manafatra lalana');
assert.match(malagasy.casSignIn, /CAS/);
assert.equal(malagasy['cardType-linkedBoard'], 'Solaitra mifandray');
assert.match(malagasy['map-to-existing-user-desc'],
/karatra.*fanamarihana.*hetsika/);
assert.equal(malagasy['map-to-existing-user-no-results'],
'Tsy nahitana mpampiasa mifanaraka.');
assert.match(malagasy['font-preview-text'], /0123456789/);
assert.equal(malagasy['auto-list-width'],
"Sakan'ny lisitra mandeha ho azy");
assert.match(malagasy['card-aging-days'], /3/);
assert.equal(malagasy['move-card-up'], 'Afindrao miakatra ny karatra');
assert.equal(malagasy['color-red'], 'mena');
assert.equal(malagasy['color-silver'], 'volafotsy');
assert.equal(malagasy['color-magenta'], 'mena volomparasy');
assert.equal(malagasy['color-white'], 'fotsy');
assert.equal(malagasy['read-only'], 'Vakiana ihany');
assert.equal(malagasy.worker, 'Mpiasa');
const bulkCardExample = JSON.parse(malagasy['copyManyCardsPopup-format']);
assert.deepEqual(Object.keys(bulkCardExample[0]), ['title', 'description']);
assert.equal(malagasy['custom-field-number'], 'Isa');
assert.match(malagasy['edit-wip-limit'], /WIP/);
assert.deepEqual(tokens(malagasy['email-enrollAccount-text']),
['__url__', '__user__']);
assert.deepEqual(tokens(malagasy['email-invite-text']),
['__board__', '__inviter__', '__url__', '__user__']);
assert.deepEqual(tokens(malagasy['email-verifyEmail-text']),
['__url__', '__user__']);
assert.match(malagasy['error-import-empty-board'], /WeKan/);
assert.equal(malagasy['export-card-pdf'], 'Manondrana karatra ho PDF');
assert.match(malagasy['export-card-excel-fields'], /Excel/);
assert.match(malagasy['export-card-excel-no-disk-space'], /Excel/);
assert.equal(malagasy['filter-due-tomorrow'], 'Voatondro rahampitso');
assert.equal(malagasy['filter-no-member'], 'Tsy misy mpikambana');
assert.match(malagasy['advanced-filter-description'],
/== != <= >= && \|\| \( \).*Field1 == Value1.*'Field 1' == 'Value 1'.*Field1 == I\\'m.*F1 == V1 \|\| F1 == V2.*F1 == \/Tes\.\*\/i/);
assert.deepEqual(tokens(malagasy['import-board-instruction-issues']),
['__endpoint__', '__sourceName__']);
assert.match(malagasy['import-board-instruction-openproject'],
/GET \/api\/v3\/work_packages/);
assert.match(malagasy['import-board-instruction-jira'],
/GET \/rest\/api\/3\/search\/jql.*automationRules/);
assert.match(malagasy['import-excel-file'], /.xlsx/);
assert.match(malagasy['trello-api-key'],
/https:\/\/trello\.com\/app-key/);
assert.match(malagasy['trello-api-import-desc'], /Trello API/);
assert.match(malagasy['invalid-year'], /2026/);
assert.deepEqual(tokens(malagasy['label-default']), ['%s']);
assert.deepEqual(tokens(malagasy['leave-board-pop']), ['__boardTitle__']);
assert.match(malagasy['listImportCardPopup-title'], /Trello/);
assert.match(malagasy['listImportCardsTsvPopup-title'], /Excel CSV\/TSV/);
assert.equal(malagasy.normal, 'Mahazatra');
assert.equal(malagasy['multi-selection'], 'Safidy maro');
assert.deepEqual(tokens(malagasy['page-maybe-private']), ['%s']);
assert.deepEqual(tags(malagasy['page-maybe-private']),
["</a>", "<a href='%s'>"]);
assert.deepEqual(tokens(malagasy['remove-member-pop']),
['__boardTitle__', '__name__', '__username__']);
assert.match(malagasy['sandstorm-remove-member-warning'],
/WeKan.*Sandstorm.*Sandstorm/);
assert.match(malagasy['setWipLimitPopup-title'], /WIP/);
assert.match(malagasy['toggle-assignees'], /1-9/);
assert.match(malagasy['custom-top-left-corner-logo-height'], /27/);
assert.match(malagasy['automatic-linked-url-schemes'], /URL.*URL/);
assert.equal(malagasy['board-templates-swimlane'],
'Lasitry ny solaitra');
assert.match(malagasy['wipLimitErrorPopup-dialog-pt1'], /WIP/);
assert.match(malagasy['attachment-transfer-limits-title'], /API/);
assert.match(malagasy['smtp-tls-description'], /TLS.*SMTP/);
assert.deepEqual(tokens(malagasy['email-invite-register-text']),
['__icode__', '__inviter__', '__url__', '__user__']);
assert.match(malagasy['email-smtp-test-subject'], /SMTP/);
assert.match(malagasy.Node_version, /Node/);
assert.match(malagasy.Meteor_version, /Meteor/);
assert.match(malagasy.FerretDB_version, /FerretDB/);
assert.match(malagasy.Reactivity_mode, /changeStreams.*oplog.*polling/);
assert.match(malagasy.Reactivity_order, /METEOR_REACTIVITY_ORDER/);
assert.match(malagasy.DDP_transport, /DDP.*DDP_TRANSPORT/);
assert.match(malagasy['org-domains-description'],
/a\.example\.com.*kanban\.example\.org.*MULTITENANCY=true/);
assert.deepEqual(tokens(malagasy['default-subtasks-board']), ['__board__']);
assert.match(malagasy['checklist-count-on-minicard'], /0\/0/);
assert.equal(malagasy['parent-card'], 'Karatra ray aman-dreny');
assert.deepEqual(tokens(malagasy['activity-added-label']), ['%s', '%s']);
assert.deepEqual(tokens(malagasy['activity-set-customfield']),
['%s', '%s', '%s']);
assert.deepEqual(tokens(malagasy['r-w-every-day-at']), ['__time__']);
assert.deepEqual(tokens(malagasy['r-import-done']), ['__count__']);
assert.match(malagasy['r-import-trello-note'], /Trello.*Butler.*Butler/);
assert.equal(malagasy['r-workspace'], 'Toeram-piasana');
assert.match(malagasy['r-import-workflow-note'], /n8n.*Node-RED.*WeKan/);
assert.deepEqual(tokens(malagasy['r-import-unmapped']), ['__count__']);
assert.match(malagasy['r-schedule-weekday'], /Alats–Zoma/);
assert.match(malagasy['r-for-n-days'], /N/);
assert.equal(malagasy['r-card-button'], 'Bokotra karatra');
assert.equal(malagasy['r-card'], 'karatra');
assert.equal(malagasy['r-list'], 'lisitra');
assert.equal(malagasy['r-checklist'], 'lisitra fanamarinana');
assert.equal(malagasy['r-d-move-to-top-gen'],
"Afindrao eo an-tampon'ny lisiny ny karatra");
assert.equal(malagasy['r-d-send-email'], 'Mandefasa mailaka');
assert.equal(malagasy['r-items-list'], 'singa1,singa2,singa3');
assert.equal(malagasy['r-add-swimlane'], 'Ampio lalana');
assert.match(malagasy['custom-head-meta-tags'], /HTML/);
assert.match(malagasy['custom-head-manifest-content'], /JSON/);
assert.match(malagasy['custom-assetlinks-content'], /assetlinks\.json.*JSON/);
assert.deepEqual(tags(malagasy['add-custom-html-after-body-start']), ['<body>']);
assert.deepEqual(tags(malagasy['add-custom-html-before-body-end']), ['</body>']);
assert.match(malagasy['oidc-button-text'], /OIDC/);
assert.deepEqual(tokens(malagasy['act-a-dueAt']),
['__card__', '__timeOldValue__', '__timeValue__']);
assert.deepEqual(tokens(malagasy['act-atUserComment']),
['__board__', '__card__', '__comment__', '__list__', '__swimlane__']);
assert.match(malagasy['submit-on-enter-description'],
/Enter.*Shift\+Enter.*Ctrl\/Cmd\+Enter.*Enter/);
assert.match(malagasy['roles-info'], /Tontonana mpitantana/);
assert.equal(malagasy.monday, 'Alatsinainy');
assert.equal(malagasy.sunday, 'Alahady');
assert.equal(malagasy.voting, 'Fifidianana');
assert.match(malagasy['invalid-domain'], /example\.com.*@/);
assert.equal(malagasy.person, 'Olona');
assert.match(malagasy['dueCardsViewChange-choice-all-description'],
/\*Voatondro\*/);
assert.deepEqual(tokens(malagasy['board-title-not-found']), ['%s']);
assert.deepEqual(tokens(malagasy['label-color-not-found']), ['%s']);
assert.deepEqual(tokens(malagasy['n-n-of-n-cards-found']),
['__end__', '__start__', '__total__']);
assert.equal(malagasy['operator-board'], 'solaitra');
assert.equal(malagasy['operator-swimlane'], 'lalana');
assert.equal(malagasy['operator-checklist-text'], 'lisitra-fanamarinana');
assert.equal(malagasy['predicate-overdue'], 'tara');
assert.deepEqual(tokens(malagasy['operator-number-expected']),
['__operator__', '__value__']);
assert.deepEqual(tokens(malagasy['globalSearch-instructions-description']),
['__operator_list__']);
assert.deepEqual(tokens(malagasy['globalSearch-instructions-operator-has']),
['__operator_has__', '__predicate_assignee__', '__predicate_attachment__',
'__predicate_checklist__', '__predicate_description__', '__predicate_due__',
'__predicate_end__', '__predicate_member__', '__predicate_start__']);
assert.match(malagasy['globalSearch-instructions-notes-2'], /\*OR\*/);
assert.match(malagasy['globalSearch-instructions-notes-3'], /\*AND\*/);
assert.match(malagasy['sort-boards-title-asc'], /A → Z/);
assert.match(malagasy['import-dependencies-file'], /JSON.*SVG/);
assert.deepEqual(tokens(malagasy['import-dependencies-done']),
['__imported__', '__unmatched__']);
assert.deepEqual(tokens(malagasy['background-too-big']), ['{{size}}']);
assert.equal(malagasy['location-open-map'], "Sokafy amin'ny sarintany");
assert.match(malagasy['server-error-troubleshooting'],
/sudo snap logs wekan\.wekan.*sudo docker logs wekan-app/s);
assert.deepEqual(tokens(malagasy['custom-field-stringtemplate-format']),
['%{value}']);
assert.match(malagasy['custom-field-stringtemplate-separator'],
/&#32;.*&nbsp;/);
assert.match(malagasy['office-report-desc'], /IPv4.*IPv6/);
assert.match(malagasy.cpuReportTitle, /CPU/);
assert.match(malagasy['api-report-desc'], /REST API/);
assert.match(malagasy['api-no-calls'], /REST API.*API.*WITH_API=true/);
assert.match(malagasy['recovery-report-desc'], /MongoDB/);
assert.equal(malagasy['copy-swimlane'], 'Adikao ny lalana');
assert.match(malagasy['carbon-copy'], /Cc:/);
assert.match(malagasy.Node_heap_malloced_memory, /Node.*malloc/);
assert.match(malagasy.Node_memory_usage_rss, /Node/);
assert.match(malagasy['custom-legal-notice-link-url'], /URL/);
assert.match(malagasy['attachment-move-storage-gridfs'], /GridFS/);
assert.match(malagasy['attachment-move-storage-s3'], /S3/);
assert.match(malagasy['attachment-repair-locations-description'], /GridFS/);
assert.match(malagasy['gridfs-file-id'], /ID.*GridFS/);
assert.match(malagasy['mongodb-compact-description'],
/MongoDB GridFS.*Compact/);
assert.match(malagasy['mongodb-compact-warning'],
/Compact.*oplog.*Meteor/);
assert.match(malagasy['mongodb-compact-run'], /MongoDB Compact/);
assert.deepEqual(tokens(malagasy['drag-board-to-workspace']),
['__workspaces__']);
assert.match(malagasy['preview-pdf-not-supported'], /PDF/);
assert.match(malagasy['show-week-of-year'], /ISO 8601/);
assert.match(malagasy['import-board-zip'], /.zip.*JSON/);
assert.equal(malagasy.accessibility, 'Fahafahana miditra');
assert.match(malagasy['accounts-lockout-info'], /fidirana.*fanafihana/);
assert.match(malagasy['accounts-lockout-known-users'],
/solonanarana.*tenimiafina/);
assert.match(malagasy['accounts-lockout-period'], /segondra/);
assert.equal(malagasy['active-cron-jobs'], 'Asa voalahatra mavitrika');
assert.equal(malagasy['board-operations'], 'Hetsiky ny solaitra');
assert.equal(malagasy['cron-job-deleted'],
'Voafafa soa aman-tsara ny asa voalahatra');
assert.match(malagasy['s3-force-path-style-description'], /MinIO.*S3.*AWS/);
assert.match(malagasy['database-migration-description'],
/MongoDB.*FerretDB v1.*SQLite.*WEKAN_FERRETDB_URL.*WEKAN_MONGODB_URL.*MONGO_URL.*Snap/s);
assert.deepEqual(tokens(malagasy['database-migration-confirm']), ['__db__']);
for (const term of ['Sandstorm', 'WeKan', 'MongoDB 3', 'FerretDB v1',
'SQLite', 'files/attachments', 'files/avatars']) {
assert.match(malagasy['sandstorm-migration-description'],
new RegExp(term.replace('/', '\\/')));
}
assert.match(malagasy['cards-loading-description'],
/WeKan.*CARDS_LOADING.*all\/lazy\/auto.*CARDS_LOADING_LAZY_THRESHOLD/s);
assert.deepEqual(tags(malagasy['render-links-as-plain-text-description']),
['<a href>']);
assert.match(malagasy['always-show-code-as-text-description'],
/HTML.*<!-- -->.*JavaScript/s);
assert.match(malagasy['disable-all-import-description'],
/WeKan JSON.*Trello.*CSV\/Excel.*Forgejo/s);
assert.match(malagasy['backup-description'],
/backup\/YYYY\/MM\/DD\/HH_MM_SS\/backup\.zip.*S3\/MinIO.*Azure.*GCS/s);
assert.match(malagasy['backup-time'], /HH:MM/);
assert.match(malagasy['gcs-permissions-note'],
/WeKan.*Google Cloud Console.*client_email.*Storage Object Admin/s);
assert.match(malagasy['s3-endpoint-menu-path'],
/AWS.*S3.*URL.*MinIO.*Cloudflare R2.*Backblaze B2.*Wasabi.*DigitalOcean Spaces/s);
assert.match(malagasy['gcs-credentials-menu-path'],
/Google Cloud Console.*IAM & Admin.*JSON/s);
assert.equal(malagasy['attachment-move-storage-azure'],
"Afindrao any amin'ny Azure Blob Storage ny rakitra miaraka");
assert.equal(malagasy['attachment-move-storage-gcs'],
"Afindrao any amin'ny Google Cloud Storage ny rakitra miaraka");
assert.match(malagasy['gridfs-enabled-description'], /MongoDB GridFS/);
assert.match(malagasy['gridfs-move-collectionfs-note'], /CollectionFS/);
assert.match(malagasy['s3-region-description'], /AWS S3.*us-east-1/);
assert.match(malagasy['s3-ssl-enabled-description'], /SSL\/TLS.*S3/);
assert.match(malagasy['restore-lost-cards-migration-description'],
/swimlaneId.*listId.*Karatra very/s);
assert.match(malagasy['restore-all-archived-migration-description'],
/swimlaneId.*listId/s);
assert.match(malagasy['fix-avatar-urls-migration-description'], /URL/);
assert.match(malagasy['run-restore-lost-cards-migration-confirm'],
/Karatra very.*swimlaneId.*listId/s);
assert.equal(malagasy['step-fix-orphaned-cards'],
'Amboary ny karatra kamboty');
assert.match(malagasy['step-fix-attachment-urls'], /URL/);
assert.match(malagasy['step-fix-missing-ids'], /ID/);
assert.match(malagasy['cpu-cores'], /CPU/);
assert.equal(malagasy['every-30-minutes'], 'Isaky ny 30 minitra');
assert.match(malagasy['gridfs-attachments'], /GridFS/);
assert.match(malagasy['migrate-all-to-gridfs'], /GridFS/);
assert.match(malagasy['migrate-all-to-s3'], /S3/);
assert.match(malagasy['migration-cpu-threshold'], /CPU.*%/);
assert.match(malagasy['migration-cpu-threshold-description'], /CPU.*10-90/);
assert.match(malagasy['migration-delay-ms-description'], /100-10000/);
assert.match(malagasy.otp, /OTP/);
assert.match(malagasy['api-endpoints'], /API/);
assert.match(malagasy['problems-in-progress-help'], /CPU/);
assert.deepEqual(tokens(malagasy['repair-broken-cards-done']), ['__fixed__']);
assert.deepEqual(tokens(malagasy['repair-broken-cards-done-unfixable']),
['__fixed__', '__unfixable__']);
assert.equal(malagasy['event-ipv4'], 'Adiresy IPv4');
assert.equal(malagasy['event-ipv6'], 'Adiresy IPv6');
assert.match(malagasy['import-here-instruction'], /WeKan.*\.json.*\.zip/);
assert.deepEqual(tokens(malagasy['globalSearch-instructions-operator-number']),
['__operator_number__']);
assert.match(malagasy['import-board-source'],
/Trello.*Jira.*WeKan.*CSV.*Excel/);