Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [1.2.2] - 2026-10-26

### Changed
- Generated files import namespaces with ordinary `using` directives at the top of the file and refer to types by
their short names (`LocalizedTables.GetString(...)`, `LocalizedString`, `Sprite`, `Dictionary<string, object>`)
instead of `global::`-qualified names. A type stays `global::`-qualified only when its short name could bind to
another type (two asset types with the same name, a nested class from a key separator, or a type with that name
in the generated namespace or its parents).
- Table classes no longer take the name of a type the generated code refers to (`Dictionary`, `UniTask`, an asset
type such as `Sprite`, …); such a class gets a `Table` suffix.

### Removed
- The **Use Runtime Alias** setting and the `using __LT = ...;` alias, which the regular `using` directives replace.

## [1.2.1] - 2026-10-24

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Severnbli.LocalizationCodegen.Installer
public static partial class Installer
{
public const string PackageId = "com.severnbli.localization-codegen";
public const string Version = "1.2.1";
public const string Version = "1.2.2";

static Installer()
{
Expand Down
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Add the scoped registry and the dependency to `Packages/manifest.json`:
}
],
"dependencies": {
"com.severnbli.localization-codegen": "1.2.1"
"com.severnbli.localization-codegen": "1.2.2"
}
}
```
Expand Down Expand Up @@ -195,20 +195,20 @@ Given a string table collection named `Ui` containing the key `HelloWorld`, the
```csharp
// <auto-generated by Localization Codegen>
// Table collection: Ui
using __LT = global::Severnbli.LocalizationCodegen.LocalizedTables;
using Severnbli.LocalizationCodegen;

namespace Localization
{
public static class Ui
{
public const string TableName = "Ui";

public static string HelloWorld => __LT.GetString(TableName, "HelloWorld");
public static string HelloWorld => LocalizedTables.GetString(TableName, "HelloWorld");
}
}
```

The `__LT` alias is declared once per file. All other types (`LocalizedString`, asset types, `Dictionary<,>`) stay fully `global::`-qualified, so your own types can never shadow them.
Each file imports the namespaces it needs with ordinary `using` directives at the top and refers to every type (`LocalizedTables`, `LocalizedString`, asset types, `Dictionary<,>`) by its short name. When a short name could bind to another type – two asset types with the same name, a nested class created by a key separator, or a type with that name in your namespace – only that type stays `global::`-qualified.

Use it anywhere from your game code:

Expand All @@ -233,7 +233,7 @@ Generated identifiers always stay valid C#:
- C# keywords get an `@` prefix.
- Collisions get a numeric suffix, assigned by entry id so older keys keep their names.
- Class names collide case-insensitively (`Ui` and `UI` get separate files on Windows/macOS).
- Reserved names (`System`, `UnityEngine`, `Unity`, the first namespace segment, …) get a `Table` suffix.
- Reserved names (`System`, `UnityEngine`, `Unity`, the first namespace segment, …) and the names of types the generated code refers to (`LocalizedTables`, `Dictionary`, `Sprite`, …) get a `Table` suffix.
- Windows device names (`CON`, `NUL`, `COM1`, …) get a trailing `_`.

With **Naming Convention = PascalCase** and optional **Key Separators**, `player name` becomes `PlayerName` and `Menu/Start` becomes the nested class `Menu.Start`. These options are off by default, so upgraded projects keep their existing API.
Expand All @@ -245,8 +245,8 @@ Enable **Smart Strings = Methods** to turn entries that need arguments into meth
```csharp
// "{0}, you have {count:plural:one item|{} items}"
public static string Greeting(object arg0, int count)
=> __LT.GetStringMixed(TableName, "Greeting", new object[] { arg0 },
new global::System.Collections.Generic.Dictionary<string, object> { ["count"] = count });
=> LocalizedTables.GetStringMixed(TableName, "Greeting", new object[] { arg0 },
new Dictionary<string, object> { ["count"] = count });
```

- Positional placeholders (`{0}`) become `arg0`, `arg1`, … (gaps are filled).
Expand All @@ -269,8 +269,8 @@ Enable **Generate Reference Members** to also get a nested `Ref` class that retu
```csharp
public static class Ref
{
public static global::UnityEngine.Localization.LocalizedString HelloWorld
=> new global::UnityEngine.Localization.LocalizedString(TableName, "HelloWorld");
public static LocalizedString HelloWorld
=> new LocalizedString(TableName, "HelloWorld");
}
```

Expand All @@ -292,10 +292,10 @@ Asset entries use `LocalizedSprite`, `LocalizedAudioClip`, `LocalizedAsset<T>` a
Install [UniTask](https://github.com/Cysharp/UniTask) (`com.cysharp.unitask` 2.x) and enable **UniTask Members** to emit an awaitable variant next to every member:

```csharp
public static string HelloWorld => __LT.GetString(TableName, "HelloWorld");
public static string HelloWorld => LocalizedTables.GetString(TableName, "HelloWorld");

public static global::Cysharp.Threading.Tasks.UniTask<string> HelloWorldAsync(global::System.Threading.CancellationToken cancellationToken = default)
=> global::Severnbli.LocalizationCodegen.LocalizedTablesUniTask.GetStringAsync(TableName, "HelloWorld", cancellationToken);
public static UniTask<string> HelloWorldAsync(CancellationToken cancellationToken = default)
=> LocalizedTablesUniTask.GetStringAsync(TableName, "HelloWorld", cancellationToken);
```

```csharp
Expand Down Expand Up @@ -323,7 +323,6 @@ Open **Project Settings > Localization Codegen**, or **Window > Localization Cod
| String Tables | on | Generate classes for string table collections. Disabling deletes the matching files on the next run. |
| Asset Tables | on | Generate classes for asset table collections. Disabling deletes the matching files on the next run. |
| Regenerate On Changes | on | Debounced automatic regeneration after table edits and external (VCS) changes. |
| Use Runtime Alias | on | Emit one `using __LT = ...;` instead of repeating the runtime type on every member. |
| Generate Reference Members | off | Emit the nested [`Ref` class](#reference-members). |
| XML Documentation | off | Add XML docs with the default locale text and smart string parameters. |
| Smart Strings | off (upgraded) / `Methods` (new) | `Off`, `Methods` or `MethodsAndRefs`. |
Expand Down
14 changes: 14 additions & 0 deletions Unity-Package/Assets/root/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [1.2.2] - 2026-10-26

### Changed
- Generated files import namespaces with ordinary `using` directives at the top of the file and refer to types by
their short names (`LocalizedTables.GetString(...)`, `LocalizedString`, `Sprite`, `Dictionary<string, object>`)
instead of `global::`-qualified names. A type stays `global::`-qualified only when its short name could bind to
another type (two asset types with the same name, a nested class from a key separator, or a type with that name
in the generated namespace or its parents).
- Table classes no longer take the name of a type the generated code refers to (`Dictionary`, `UniTask`, an asset
type such as `Sprite`, …); such a class gets a `Table` suffix.

### Removed
- The **Use Runtime Alias** setting and the `using __LT = ...;` alias, which the regular `using` directives replace.

## [1.2.1] - 2026-10-24

### Added
Expand Down
Loading
Loading