Skip to content
This repository has been archived by the owner on Jan 10, 2020. It is now read-only.

Multilanguage case: improper language url and correspondent tab when editing a module item #65

Closed
Mariana-Marica opened this issue Apr 28, 2017 · 10 comments

Comments

@Mariana-Marica
Copy link

When editing a module item in admin panel -> the form fields from the first language are displayed ("default-language" in quarx.php), but the last language tab is highlighted and the correspondent language url is not being loaded

@mlantz
Copy link
Member

mlantz commented Apr 28, 2017

I'll need a bigger description of this, can you provide example urls and some screenshots possibly. Its hard to isolate exactly what isnt working correctly for you.

@Mariana-Marica
Copy link
Author

Mariana-Marica commented May 2, 2017

I provide steps and screenshot with problem encountered:

  • i have set in app.php 'locale' => 'fr', and 'fallback_locale' => 'en', & in quarx.php the following:
    'auto-translate' => true,
    'default-language' => 'fr',
    'languages' => [
        'fr' => 'français',
        'en' => 'english',
    ],
  • i create a page 'test-page' and then, after submit i am on the same page, on edit case;
  • after submit the url has no lang param regarding the actual language i am positioned on (it's just quarx/pages/{id}/edit with no language) and the highlighted language tab is always the last one, in my case 'english';
  • on create and update if i write some content, it will be saved for first language, 'french' in my case, although english tab is active; if i don't specifically click a language tab, the url will not appear with corresponding lang param '?lang=fr' and the corresponding lang tab is not highlighted;
    edit

@mlantz
Copy link
Member

mlantz commented May 2, 2017

Awesome, thanks, replicating this setup - I'm getting the same issue, I'll see what I can fix today

@mlantz
Copy link
Member

mlantz commented May 2, 2017

K, solved it, there were a couple issues. Will be pushing update today

@Mariana-Marica
Copy link
Author

Thank you !

@mlantz mlantz closed this as completed May 3, 2017
@Mariana-Marica
Copy link
Author

I still see the same behavior !

@mlantz
Copy link
Member

mlantz commented May 19, 2017

What version do you have in the bottom corner? and did you replace your resources/views/vendor/quarx views?

@Mariana-Marica
Copy link
Author

Mariana-Marica commented May 19, 2017

I updated the dependencies just today and i have the latest Quarx version 2.3.21. I don't really know what exactly to replace, why and where, can you give more info on this pls ?

@Mariana-Marica
Copy link
Author

Mariana-Marica commented May 31, 2017

  • yes, i should have published the vendor by running 'php artisan vendor:publish' that replaces resources/views/vendor/quarx with the ones from project_name/vendor/yab/quarx/src/Views;
  • it now works for default quarx modules, but i can mention that after creating a new module, the language tabs from custom module edit in admin panel are still loaded the same (because of Quarx::config('quarx.languages')) instead of config('quarx.languages'))):
        <ul class="nav nav-tabs">
            @foreach(config('quarx.languages', Quarx::config('quarx.languages')) as $short => $language)
                <li role="presentation"
                    @if (request('lang') == $short || is_null(request('lang')) && $short == Quarx::config('quarx.default-language'))) class="active" @endif>
                    <a href="{{ url('quarx/blogcategories/'.$blogcategory->id.'/edit?lang='.$short) }}">{{ ucfirst($language) }}</a>
                </li>
            @endforeach
        </ul>

@mlantz
Copy link
Member

mlantz commented Jun 2, 2017

@foreach(config('quarx.languages') as $short => $language)
    <li role="presentation" @if (request('lang') == $short || is_null(request('lang')) && $short == config('quarx.default-language'))) class="active" @endif><a href="{{ url('quarx/blog/'.$blog->id.'/edit?lang='.$short) }}">{{ ucfirst($language) }}</a></li>
@endforeach

This should be accurate. I have not yet made a means of setting modules as multilingual but its on my todo list.

You will also need to make sure your module uses Yab\Quarx\Traits\Translatable also check out the BlogRepository and look at the update method to make sure you're saving the languages

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants