Fluent: Get "page_by_lang" functionality for templates

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version: 4.5

Question:

Inside my Footer Template I list serveral pages.
I would like to control them with a similar method/synatx like in SilverStripe 3.

Basically a function which accepts the UrlSegment and the Locale.

<% with $page_by_lang("home", "de_DE") %>
...
<% end_with %>

I am struggeling with fluent to achieve this.

Thanks for any help.

I managed it. For anyone in the same situation:

public function PageByLang($urlSegment, $locale)
{
    return FluentState::singleton()->withState(function (FluentState $newState) use ($urlSegment, $locale) {
        $newState->setLocale($locale);
        $page = SiteTree::get()->filter([
            'URLSegment' => $urlSegment
        ])->first();

        $newState->setLocale(i18n::get_locale());
        return SiteTree::get()->byID($page->ID);
    });
}