@ -0,0 +1,63 @@ |
||||
const i18n = require('eleventy-plugin-i18n'); |
||||
const translations = require('./src/_data/i18n'); |
||||
|
||||
module.exports = function (eleventyConfig) { |
||||
// Plugins
|
||||
eleventyConfig.addPlugin(i18n, { |
||||
defaultLanguage: 'de', |
||||
localesDirectory: 'src', |
||||
// optional: customize the URL structure
|
||||
urlPrefix: locale => (locale === 'de' ? '' : `/${locale}`), |
||||
translations, |
||||
fallbackLocales: { |
||||
'*': 'de' |
||||
} |
||||
}); |
||||
|
||||
// TEMP demo of what could be an i18n-aware plural package?
|
||||
eleventyConfig.addFilter('pluralize', function (term, count = 1) { |
||||
// Poorman's pluralize for now...
|
||||
return count === 1 ? term : `${term}s`; |
||||
}); |
||||
|
||||
eleventyConfig.addFilter('localizedPermalink', (slug, locale) => { |
||||
const newPath = locale === 'de' ? `${slug.slice(3)}.html` : `${slug}.html`; |
||||
return `${newPath}`; |
||||
}); |
||||
|
||||
// these folders will be copied into webroot
|
||||
// e.g. /image => /_site/image
|
||||
eleventyConfig.addPassthroughCopy('image'); |
||||
eleventyConfig.addPassthroughCopy('css'); |
||||
eleventyConfig.addPassthroughCopy('font'); |
||||
|
||||
// contents of public folder will be copied into webroot
|
||||
// e.g. /public/something.html => /_site/something.html
|
||||
eleventyConfig.addPassthroughCopy({ "public": "." }); |
||||
|
||||
// Browsersync
|
||||
// Redirect from root to default language root during --serve
|
||||
// Can also be handled by netlify.toml?
|
||||
eleventyConfig.setBrowserSyncConfig({ |
||||
callbacks: { |
||||
ready: function (err, bs) { |
||||
bs.addMiddleware('*', (req, res) => { |
||||
if (req.url === '/') { |
||||
res.writeHead(302, { |
||||
location: '/en/' |
||||
}); |
||||
res.end(); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
// Configuration
|
||||
return { |
||||
dir: { |
||||
input: 'src' |
||||
}, |
||||
markdownTemplateEngine: 'njk' |
||||
}; |
||||
}; |
@ -0,0 +1,2 @@ |
||||
node_modules |
||||
_site |
@ -0,0 +1,14 @@ |
||||
{ |
||||
"singleQuote": true, |
||||
"trailingComma": "none", |
||||
"arrowParens": "avoid", |
||||
"overrides": [ |
||||
{ |
||||
"files": "*.css", |
||||
"options": { |
||||
"printWidth": 140, |
||||
"singleQuote": false |
||||
} |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,21 @@ |
||||
MIT License |
||||
|
||||
Copyright (c) 2025 Chaostreff Tübingen e. V. |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
@ -0,0 +1,16 @@ |
||||
# TDF Eleventy |
||||
|
||||
Based on the demo site [`eleventy-plugin-i18n-demo`](https://github.com/adamduncan/eleventy-plugin-i18n-demo). |
||||
|
||||
|
||||
# Setup |
||||
Install |
||||
|
||||
`npm install` |
||||
|
||||
Run local webserver |
||||
|
||||
`npx @11ty/eleventy --serve` |
||||
|
||||
Note: |
||||
the index.js containing translations won't automatically be updated, you may need to restart the webserver for it to reflect the changes |
@ -0,0 +1,21 @@ |
||||
MIT License |
||||
|
||||
Copyright (c) 2020 Adam Duncan |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
@ -0,0 +1,4 @@ |
||||
[[redirects]] |
||||
from = "/" |
||||
to = "/en" |
||||
status = 301 |
@ -0,0 +1,33 @@ |
||||
{ |
||||
"name": "eleventy-plugin-i18n-demo", |
||||
"version": "0.1.0", |
||||
"description": "Demo site for eleventy-plugin-i18n", |
||||
"main": "index.js", |
||||
"scripts": { |
||||
"start": "npm run serve", |
||||
"serve": "cross-env ELEVENTY_ENV=development npx eleventy --serve", |
||||
"build": "cross-env ELEVENTY_ENV=production npx eleventy", |
||||
"debug": "cross-env DEBUG=* npx eleventy" |
||||
}, |
||||
"keywords": [], |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/adamduncan/eleventy-plugin-i18n-demo.git" |
||||
}, |
||||
"author": "Adam Duncan <mail@adamduncandesigns.com> (https://adamduncandesigns.com)", |
||||
"bugs": { |
||||
"url": "https://github.com/adamduncan/eleventy-plugin-i18n-demo/issues" |
||||
}, |
||||
"homepage": "https://github.com/adamduncan/eleventy-plugin-i18n-demo#readme", |
||||
"license": "MIT", |
||||
"devDependencies": { |
||||
"@11ty/eleventy": "^3.1.2", |
||||
"cross-env": "^7.0.2", |
||||
"lodash.get": "^4.4.2", |
||||
"prettier": "^2.0.5", |
||||
"templite": "^1.1.0" |
||||
}, |
||||
"dependencies": { |
||||
"eleventy-plugin-i18n": "^0.1.3" |
||||
} |
||||
} |
Before Width: | Height: | Size: 972 KiB After Width: | Height: | Size: 972 KiB |
Before Width: | Height: | Size: 469 KiB After Width: | Height: | Size: 469 KiB |
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 618 B |
Before Width: | Height: | Size: 43 B After Width: | Height: | Size: 43 B |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.0 MiB |
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 720 KiB After Width: | Height: | Size: 720 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 293 KiB After Width: | Height: | Size: 293 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 115 KiB |
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 163 KiB |
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 144 KiB |
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 128 KiB |
Before Width: | Height: | Size: 178 KiB After Width: | Height: | Size: 178 KiB |
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 157 KiB |
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 179 KiB |
Before Width: | Height: | Size: 215 KiB After Width: | Height: | Size: 215 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 130 KiB |
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |