Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't generate menu correctly #23

Open
felijung opened this issue Jan 22, 2021 · 3 comments
Open

can't generate menu correctly #23

felijung opened this issue Jan 22, 2021 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@felijung
Copy link

Hi,

when I change away from the default "catergoy-1" & "category-2" to let's say categories "en" and "de" and then have files therein, I cannot generate a correct menu. The html is generated, but for the menu to show the new category I can manually edit the settings.py to the new names of categories - but that is not the intended way I suspect?

@fscherf
Copy link
Contributor

fscherf commented Jan 25, 2021

hi @felijung,

i think you need flamingo.plugins.I18N.

'en' or 'de' shouldn't be menu entries but languages, managed by flamingos i18n plugin. Then you can create a menu for 'de' and 'en'

Can you post a link to your projekt?

@fscherf fscherf added the help wanted Extra attention is needed label Jan 25, 2021
@felijung
Copy link
Author

Hi,
thanks for reminding me of l18N. The en and de were placeholder though, the first that came to my mind.
Now I have the lang-plugin but the problem with the menu kinda stays the same.
My setting.py right now looks (in the relevant parts i guess) as follows

PLUGINS = [
    'flamingo.plugins.Menu',
    'flamingo.plugins.Bootstrap4',
    'flamingo.plugins.jQuery3',
    'flamingo.plugins.I18N',

    'plugins/example.py::ExamplePlugin',
]

I18N_CONTENT_KEY = 'id'
I18N_LANGUAGES = ['en', 'de']
I18N_DEFAULT_LANGUAGE = 'en'

MENU = [
    ['Home', 'home.rst'],
    ['About',  [
        ['About', 'about/about_en.rst'],
        ['Über', 'about/about_de.rst']

    ]]

]

both versions of about_[lang].rst have id: about and the lang: is set according to the language used.

now two thoughts/questions on that:

  • how do i get it to show a language-menu?
  • is it, for translated-posts and/or for any file to show in the menu, required to write the full path to each file in the settings.py?

@fscherf
Copy link
Contributor

fscherf commented Mar 23, 2021

Hi @felijung,

Sorry that it took me so long!

FTR: i tried to reach you on a private channel, so i can see your whole project and work out a solution for your specific problem and improve the flamingo documentation afterwards.

What you need here are two seperate menus:

MENU = {                                    
    'de': [                                 
        ['Home', 'home.rst'],               
        ['About',  [                        
            ['Über', 'about/about_de.rst']  
                                            
        ]]                                  
    ],                                      
    'en': [                                 
        ['Home', 'home.rst'],               
        ['About',  [                        
            ['About', 'about/about_en.rst'],
        ]]                                  
    ],                                      
}                                           

In your templates you can access your language specific menu like this:

{{ context.plugins.Menu.menu[content.lang] }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants