# GetLocalizedString(TableReference, TableEntryReference, Locale, object[], bool, IVariableGroup)

> Resolves a localized string synchronously, or null when it cannot be resolved without an asynchronous load.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Localization](/engine/6000.7/script-reference/unity/localization.md)
* **Assembly:** UnityEngine.LocalizationRuntimeModule

## GetLocalizedString(TableReference, TableEntryReference, Locale, Object\[], bool, IVariableGroup)

```csharp
public string GetLocalizedString(TableReference tableRef, TableEntryReference entryRef, Locale locale = null, object[] args = null, bool enableFallback = true, IVariableGroup localVariables = null)
```

### Parameters

**** (\[TableReference]\(/engine/6000.7/script-reference/unity/localization/tablereference)): The reference to the table collection that holds the entry.**** (\[TableEntryReference]\(/engine/6000.7/script-reference/unity/localization/tableentryreference)): The reference to the string entry to resolve.**** (\[Locale]\(/engine/6000.7/script-reference/unity/localization/locale)): The locale to resolve in; null uses the selected locale.**** (\[Object\[]]\(https\://learn.microsoft.com/dotnet/api/system.object)): The Smart String arguments to format placeholders with; null when the entry takes no arguments.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to walk the locale fallback chain when the locale has no value.**** (\[IVariableGroup]\(/engine/6000.7/script-reference/unity/smartstrings/persistentvariables/ivariablegroup)): The extra variables that Smart String placeholders resolve against, in addition to the arguments.

### Returns

| Type                                                           | Description                                                                                     |
| -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | The formatted localized string, or null when the table is not loaded or the entry has no value. |

### Remarks

This is the synchronous companion to [ResourceDatabase.GetLocalizedStringAsync](/engine/6000.7/script-reference/unity/localization/resourcedatabase/getlocalizedstringasync.md). It resolves from tables already cached for the locale, and otherwise loads the table through any provider that implements [ISynchronousAssetProvider](/engine/6000.7/script-reference/unity/localization/providers/isynchronousassetprovider.md) (direct references or a `Resources` load); a table that only a purely asynchronous provider can supply resolves to null until it is loaded. Use it on the main thread when you cannot await. Smart entries are formatted and the locale post-processing hook is applied like the async form.

Reads an already-loaded string without awaiting.

### Examples

```csharp
using Unity.Localization;
using UnityEngine;

namespace Unity.Localization.Samples
{
    public class GetLocalizedStringSyncExample
    {
        public void Run()
        {
            string label = LocalizationSettings.ResourceDatabase.GetLocalizedString("UI Text", "play-button");
            if (label != null)
                Debug.Log(label);
        }
    }
}
```
