Feat/language detection (#31)

* feat: implementation of language detection

* run utility scripts in tasks

* fix: addiitonal fixes for background utilities

* feat: toast() also for utility scripts

---------

Co-authored-by: hugo <hugoms@me.com>
This commit is contained in:
Georg Bauer
2026-03-03 14:36:15 +01:00
committed by GitHub
parent 5747925503
commit 32b66e1677
37 changed files with 2616 additions and 55 deletions

View File

@@ -20,6 +20,7 @@ function makePost(overrides: Partial<PostData> = {}): PostData {
content: overrides.content ?? `# ${title}\n\nBody`,
status: overrides.status ?? 'published',
author: overrides.author,
language: overrides.language,
createdAt,
updatedAt,
publishedAt: overrides.publishedAt,
@@ -155,4 +156,31 @@ describe('GenerationSitemapFeedService', () => {
expect(result.rssXml).toBe('');
expect(result.atomXml).toBe('');
});
it('includes per-post language in RSS dc:language and Atom xml:lang', () => {
const publishedPosts = [
makePost({ id: '1', slug: 'post-en', title: 'English', language: 'en' }),
makePost({ id: '2', slug: 'post-de', title: 'German', language: 'de' }),
makePost({ id: '3', slug: 'post-no-lang', title: 'Default' }),
];
const result = buildSitemapAndFeeds({
baseUrl: 'https://example.com',
projectName: 'Test Blog',
maxPostsPerPage: 10,
publishedPosts,
publishedListPosts: publishedPosts,
postIndex: buildIndex(publishedPosts),
includeFeeds: true,
});
// RSS should have dc:language per item
expect(result.rssXml).toContain('xmlns:dc=');
expect(result.rssXml).toContain('<dc:language>en</dc:language>');
expect(result.rssXml).toContain('<dc:language>de</dc:language>');
// Atom should have xml:lang on entries with language
expect(result.atomXml).toContain('xml:lang="en"');
expect(result.atomXml).toContain('xml:lang="de"');
});
});