carb/l10n/L10nUtils.h

File members: carb/l10n/L10nUtils.h

// Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once

#include "../Framework.h"
#include "IL10n.h"

#define CARB_LOCALIZATION_GLOBALS()

namespace carb
{
namespace l10n
{

inline void registerLocalizationForClient() noexcept
{
    g_carbLocalization = getFramework()->tryAcquireInterface<IL10n>();
    if (g_carbLocalization != nullptr)
        g_localizationFn = g_carbLocalization->getLocalizedStringFromHash;
}

inline void deregisterLocalizationForClient() noexcept
{
    g_carbLocalization = nullptr;
    g_localizationFn = carb::l10n::getLocalizedStringFromHashNoPlugin;
}

} // namespace l10n
} // namespace carb