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

Frontend locale menu doesn't work on login form (Security) #689

Open
purplespider opened this issue Mar 15, 2021 · 5 comments · May be fixed by #691
Open

Frontend locale menu doesn't work on login form (Security) #689

purplespider opened this issue Mar 15, 2021 · 5 comments · May be fixed by #691

Comments

@purplespider
Copy link

purplespider commented Mar 15, 2021

The locale menu (LocaleMenu.ss) doesn't appear to work when on the login form or password reset form (e.g. Security).

PR #688 fixes the issue with actions not being included in links, but there is a 2nd issue that results in the links for all Locales within the locale menu pointing to the "current" locale, instead of to the other relevant locale.

I believe the issue is getRecordLocale()(Link) is failing to obtain the relevant local when on Security and is falling back to getCurrentLocale().

But I can't get my head around how it could be resolved.

Fluent v5.0.0

PRs

@tractorcow
Copy link
Collaborator

it SHOULD work, but it works with the locale querystring argument, instead of the url prefix.

I.e. Security/login?l=en_US

This is due to Security being a controller, and not a page.

If it's not doing that, then it should be fixed to do that. :D

@tractorcow
Copy link
Collaborator

@tractorcow
Copy link
Collaborator

I believe the issue is getRecordLocale()(Link) is failing to obtain the relevant local when on Security and is falling back to getCurrentLocale().

Sorry, you are right, it's probably that code in question failing on unsaved records. :)

@purplespider
Copy link
Author

Yep, it's the generation of the locale menu items that has the issue.

Default LocaleMenu.ss

            <ul>
                <% loop $Locales %>
                    <li class="$LinkingMode">
                        <a href="$Link.ATT" <% if $LinkingMode != 'invalid' %>rel="alternate"
                           hreflang="$HrefLang"<% end_if %>>$Title.XML</a>
                    </li>
                <% end_loop %>
            </ul>

Results in: From login screen. (once #688 is resolved)

<ul>
        <li class="current">
            <a href="/Security/login?l=de_AT" rel="alternate"
                hreflang="de-at">German</a>
        </li>
    
        <li class="link">
            <a href="/Security/login?l=de_AT" rel="alternate"
                hreflang="en-gb">English</a>
        </li>
</ul>

(Note that the "English" link has the incorrect "de_AT" query string argument, instead of "en_GB")

tractorcow added a commit that referenced this issue Mar 23, 2021
@tractorcow tractorcow linked a pull request Mar 23, 2021 that will close this issue
@tractorcow
Copy link
Collaborator

Possible fix at #691

The issue is that RecordLocale doesn't tell "unsaved" records what it's locale is. We can clone and mock the query param for that object to force it. :)

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

Successfully merging a pull request may close this issue.

2 participants