Yeah baby alfin un servicio para postear codigo y se vea bonito… tendra api ?

class PageLanguageUrl(InclusionTag):
    """
    Displays the url of the current page in the defined language.
    You can set a language_changer function with the set_language_changer function in the utils.py if there is no page.
    This is needed if you have slugs in more than one language.
    """
    name = 'page_language_url'
    template = 'cms/content.html'

options = Options(
    Argument(<span style="color: #aa5500">&#39;lang&#39;</span>),
)

<span style="color: #0000aa">def</span> <span style="color: #00aa00">get_context</span>(<span style="color: #00aaaa">self</span>, context, lang):
    <span style="color: #0000aa">try</span>:
        <span style="color: #aaaaaa; font-style: italic"># If there&#39;s an exception (500), default context_processors may not be called.</span>
        request = context[<span style="color: #aa5500">&#39;request&#39;</span>]
    <span style="color: #0000aa">except</span> KeyError:
        <span style="color: #0000aa">return</span> {<span style="color: #aa5500">&#39;template&#39;</span>: <span style="color: #aa5500">&#39;cms/content.html&#39;</span>}
    <span style="color: #0000aa">if</span> <span style="color: #00aaaa">hasattr</span>(request, <span style="color: #aa5500">&quot;_language_changer&quot;</span>):
        <span style="color: #0000aa">try</span>:
            <span style="color: #00aaaa">setattr</span>(request._language_changer, <span style="color: #aa5500">&#39;request&#39;</span>, request)
        <span style="color: #0000aa">except</span> AttributeError:
            <span style="color: #0000aa">pass</span>
        url = <span style="color: #aa5500">&quot;/%s&quot;</span> % lang + request._language_changer(lang)
    <span style="color: #0000aa">else</span>:
        page = request.current_page
        <span style="color: #0000aa">if</span> page == <span style="color: #aa5500">&quot;dummy&quot;</span>:
            <span style="color: #0000aa">return</span> <span style="color: #aa5500">&#39;&#39;</span>
        <span style="color: #0000aa">try</span>:
            url = page.get_absolute_url(language=lang, fallback=<span style="color: #00aaaa">False</span>)
            url = <span style="color: #aa5500">&quot;/&quot;</span> + lang + url
        <span style="color: #0000aa">except</span>:
            <span style="color: #aaaaaa; font-style: italic"># no localized path/slug. </span>
            url = <span style="color: #aa5500">&#39;&#39;</span>
    <span style="color: #0000aa">return</span> {<span style="color: #aa5500">&#39;content&#39;</span>:url}

register.tag(PageLanguageUrl)