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 ?>

style.css was changed so that the language selector nicely ligns up left of the login section.

/var/www/wiki/lib/plugins/translation/style.css

.dokuwiki div.plugin_translation {
    float: right; 
    font-size: 95%;
    padding-right: 0.1em;
    margin : 0.0em 0 0.3em 0;
    text-align: right;
}

was chaged to:

.dokuwiki div.plugin_translation {
    display: inline-block;
    font-size: 95%;
    padding-right: 0.1em;
    margin : 0.0em 0 0.3em 0;
    text-align: right;
}

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

Since we're using both You are here: and Trace: breadcrumbs later are being moved to the right, thinning the breadcrumbs bar.

/var/www/wiki/lib/tpl/dokuwiki/css/design.less

wikidoku.1452537502.txt.gz · Zuletzt geändert: 2017/10/11 22:53 (Externe Bearbeitung)