Feature/post media translations (#42)
* chore: updated todo with translation ideas * feat: first take at the implementation of translations * fix: small addition for the translation feature * feat: support language switching in the editor and preview * feat: better handling of long bodies by not running them through a json envelope * fix: unknown macros have better fallback * feat: api for python to get translations * fix: strip dumb prefix of content in translation * feat: extend meta diff for translations * feat: hook up translations to rebuild-from-disk * feat: generation of the website prefers project language, falling back to canonical language * fix: crashes during rendering * feat: translation validation report * fix: made the translation validation actually work * chore: reorganization of menu * fix: some topics cleanup * chore: updated doc * feat: translations for media * feat: more aligned in UI/UX * feat: edit translations possible * chore: added full multi-language todo * chore: updated todo for clarity * feat: implementation of full multi-linguality * fix: page creation creates pages * fix: flags on every page * fix: better prompt * feat: made MCP server aware of language content * feat: python tools for translations * fix: better fill-in-translations * fix: better prompt for translation. maybe. * fix: losing posts from search due to translation process * fix: translation validation handles in-db content and fill-in of missing translations fixed to flush * fix: faster scanning for infilling of missing translations * chore: updated agent instructions * feat: calendar and tag cloud respect current language now * fix: retries going up * fix: got metadata-diff and rebuild into sync * fix: extended meta-diff for timestamps * fix: made website validation look at translated content, too * fix: multi-lingual search * chore: refactor Editor.tsx into two separate editors * feat: do language detection when no explicit language given --------- Co-authored-by: hugo <hugoms@me.com>
This commit is contained in:
@@ -21,6 +21,7 @@ describe('editorRouting', () => {
|
||||
documentation: 'documentation',
|
||||
'api-documentation': 'api-documentation',
|
||||
'site-validation': 'site-validation',
|
||||
'translation-validation': 'translation-validation',
|
||||
scripts: 'scripts',
|
||||
templates: 'templates',
|
||||
'find-duplicates': 'find-duplicates',
|
||||
|
||||
@@ -40,6 +40,24 @@ describe('postCreation', () => {
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it('passes provided categories to createPost', async () => {
|
||||
const createPost = vi.fn().mockResolvedValue({ id: 'page-1' });
|
||||
const setSelectedPost = vi.fn();
|
||||
|
||||
await createAndFocusPost({
|
||||
createPost,
|
||||
setSelectedPost,
|
||||
categories: ['page'],
|
||||
});
|
||||
|
||||
expect(createPost).toHaveBeenCalledWith({
|
||||
title: '',
|
||||
content: '',
|
||||
tags: [],
|
||||
categories: ['page'],
|
||||
});
|
||||
});
|
||||
|
||||
it('returns null and reports errors', async () => {
|
||||
const createPost = vi.fn().mockRejectedValue(new Error('fail'));
|
||||
const setSelectedPost = vi.fn();
|
||||
|
||||
@@ -29,6 +29,7 @@ describe('tabPolicy', () => {
|
||||
expect(getSingletonToolTabSpec('documentation')).toEqual({ type: 'documentation', id: 'documentation', isTransient: false });
|
||||
expect(getSingletonToolTabSpec('metadata-diff')).toEqual({ type: 'metadata-diff', id: 'metadata-diff', isTransient: false });
|
||||
expect(getSingletonToolTabSpec('site-validation')).toEqual({ type: 'site-validation', id: 'site-validation', isTransient: false });
|
||||
expect(getSingletonToolTabSpec('translation-validation')).toEqual({ type: 'translation-validation', id: 'translation-validation', isTransient: false });
|
||||
});
|
||||
|
||||
it('opens singleton tool tabs using canonical tab spec', () => {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import type { TranslationValidationReport } from '../../../src/main/shared/electronApi';
|
||||
import {
|
||||
getPersistedTranslationValidationReport,
|
||||
persistTranslationValidationReport,
|
||||
} from '../../../src/renderer/navigation/translationValidationPersistence';
|
||||
|
||||
const report: TranslationValidationReport = {
|
||||
checkedDatabaseRowCount: 2,
|
||||
checkedFilesystemFileCount: 3,
|
||||
invalidDatabaseRows: [
|
||||
{
|
||||
issue: 'same-language-as-canonical',
|
||||
translationId: 'translation-1',
|
||||
translationFor: 'post-1',
|
||||
canonicalLanguage: 'de',
|
||||
translationLanguage: 'de',
|
||||
title: 'Hallo Welt',
|
||||
},
|
||||
],
|
||||
invalidFilesystemFiles: [
|
||||
{
|
||||
issue: 'missing-source-post',
|
||||
translationFor: 'missing-post',
|
||||
translationLanguage: 'it',
|
||||
filePath: '/tmp/project/posts/orphan.it.md',
|
||||
title: 'Ciao',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
describe('translationValidationPersistence', () => {
|
||||
it('persists and loads translation validation report by project', () => {
|
||||
persistTranslationValidationReport('project-1', report);
|
||||
|
||||
expect(getPersistedTranslationValidationReport('project-1')).toEqual(report);
|
||||
});
|
||||
|
||||
it('returns null when project has no persisted report', () => {
|
||||
expect(getPersistedTranslationValidationReport('missing-project')).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user