Benutzer-Werkzeuge

Webseiten-Werkzeuge


wikidoku

Dies ist eine alte Version des Dokuments!


Wiki Dokumentation

Allfällige hacks und spezielle Einstellungen werden hier (hoffentlich) Dokumentiert.

plugin:translation

Language selector

Adding the selector to the theme

The snippet from plugin:translation was added to the dokuwiki theme.

/var/www/wiki/lib/tpl/dokuwiki/tpl_header.php

        <?php if ($conf['useacl']): ?>
            <div id="dokuwiki__usertools">
                <h3 class="a11y"><?php echo $lang['user_tools']; ?></h3>
                <ul>
                        <li>
                                <?php
                                        $translation = plugin_load('helper','translation');
                                        if ($translation) echo $translation->showTranslations();
                                ?>
                        </li>
                    <?php
                        if (!empty($_SERVER['REMOTE_USER'])) {
                            echo '<li class="user">';
                            tpl_userinfo(); /* 'Logged in as ...' */
                            echo '</li>';
                        }
                        tpl_toolsevent('usertools', array(
                            tpl_action('admin', true, 'li', true),
                            tpl_action('profile', true, 'li', true),
                            tpl_action('register', true, 'li', true),
                            tpl_action('login', true, 'li', true)
                        ));
                    ?>
                </ul>
            </div>
        <?php endif ?>

Problems with url rewriting

When using the language selector to switch in between de: and en: url-rewriting would not work properly.
We where getting of en:start, start/?id=de:start and de:start, start/?id=en:start\\.

We found the problem to be that script.js expects the base-url to end with / when url-rewriting is active. In our case However, it end with /start.

We implemented the following workaround to fix this:

/var/www/wiki/lib/plugins/translation/script.js

        // this should hopefully detect rewriting good enough:
        var action = $frm.attr('action');
        if(action.substr(action.length-1) == '/'){
            var link = action + id;
        }

was replaced with:

        // this should hopefully detect rewriting good enough:
        var action = $frm.attr('action').replace('/start', '/');
        if(action.substr(action.length-1) == '/'){
            var link = action + id;
        }

Nicer breadcrumbs

wikidoku.1452536883.txt.gz · Zuletzt geändert: 2020/09/19 22:03 (Externe Bearbeitung)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki