+use Shaarli\Config\ConfigManager;
+use Shaarli\Plugin\PluginManager;
+use Shaarli\Render\TemplatePage;
+
+/**
+ * In the footer hook, there is a working example of a translation extension for Shaarli.
+ *
+ * The extension must be attached to a new translation domain (i.e. NOT 'shaarli').
+ * Use case: any custom theme or non official plugin can use the translation system.
+ *
+ * See the documentation for more information.
+ */
+const EXT_TRANSLATION_DOMAIN = 'demo';
+
+/*
+ * This is not necessary, but it's easier if you don't want Poedit to mix up your translations.
+ */
+function demo_plugin_t($text, $nText = '', $nb = 1)
+{
+ return t($text, $nText, $nb, EXT_TRANSLATION_DOMAIN);
+}
+
+/**
+ * Initialization function.
+ * It will be called when the plugin is loaded.
+ * This function can be used to return a list of initialization errors.
+ *
+ * @param $conf ConfigManager instance.
+ *
+ * @return array List of errors (optional).
+ */
+function demo_plugin_init($conf)
+{
+ $conf->get('toto', 'nope');
+
+ if (! $conf->exists('translation.extensions.demo')) {
+ // Custom translation with the domain 'demo'
+ $conf->set('translation.extensions.demo', 'plugins/demo_plugin/languages/');
+ $conf->write(true);
+ }
+
+ $errors[] = 'This a demo init error.';
+ return $errors;
+}
+
+function demo_plugin_register_routes(): array
+{
+ return [
+ [
+ 'method' => 'GET',
+ 'route' => '/custom',
+ 'callable' => 'Shaarli\DemoPlugin\DemoPluginController:index',
+ ],
+ ];
+}
+