How to Localize UWP DirectX C++?

0

I have latest Visual C++ 17 (15.9.4), and started with the UWP directX C++ Template (without XAML).

When i run that, it works. It shows a multi colored spinning cube, in a window, or fullscreen if i fullscreen it, and also shows the FPS number at the botom right of the screen.

Now i want to add localization to that, and i went there:

Localize strings in your UI and app package manifest

So i Added those 2 lines from that example:

auto resourceLoader = Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView();
this->myXAMLTextBlockElement->Text = resourceLoader->GetString("Farewell");

in my code like this:

void App::Run()
{
    auto resourceLoader = Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView();
    auto myText = resourceLoader->GetString("Farewell");

    while (!m_windowClosed)
    {
        if (m_windowVisible)
        {
            CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);

            m_main->Update();

            if (m_main->Render())
            {
                m_deviceResources->Present();
            }
        }
        else
        {
            CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending);
        }
    }
}

But that doesn't work, i get an exception in the first line of that code, saying that it doesn't find the resourcemap. I did all what they said: created a "Strings" directory, and in there an "en-US" directory, and in there a Resources.resw file having the "Farewell" string set to "bye bye !".

The exception it throws:

Exception levée à 0x747D1812 dans App9.exe : exception Microsoft C++ : 
Platform::COMException ^ à l'emplacement de mémoire 0x02CDF49C. 
HRESULT:0x80073B1F ResourceMap introuvable.
Informations WinRT : ResourceMap introuvable.
c++
uwp
directx
asked on Stack Overflow Dec 28, 2018 by Lord Riton • edited Jan 3, 2019 by Lord Riton

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0