Appearance
Extraction Attributes (EN)
This page explains the extraction-related attributes available in Hyper PO Localization.
Source file:
Runtime/Scripts/Attributes/LanguageManagerAttributes.cs
Available Attributes
[DontTranslate]- Purpose: excludes a field from extraction.
[Translatable]- Purpose: explicit marker that a member is intended for translation.
- Note: in the default extractor, string and
List<string>fields in translatable assets are already scanned, so this marker is optional there.
[TranslationComment("...")]- Purpose: adds translator-facing notes to extracted entries.
[TranslationContext("...")]- Purpose: sets gettext context (
msgctxt) for the entry.
- Purpose: sets gettext context (
[TranslationPlural("...")]- Purpose: sets plural form (
msgid_plural) for the entry.
- Purpose: sets plural form (
Typical Usage
csharp
using Hyper.POLocalization.Attributes;
using UnityEngine;
[CreateAssetMenu(menuName = "Game/Dialogue Entry")]
public class DialogueEntry : ScriptableObject
{
[TranslationComment("Shown in inventory header")]
[TranslationContext("inventory")]
[TranslationPlural("{0} apples")]
public string singular = "{0} apple";
[DontTranslate]
public string debugOnly = "DEV_NOTE";
}Practical Notes
TranslationContextandTranslationPluralare most useful when your extracted key needs disambiguation or plural forms in PO/POT.- For dynamic runtime keys (for example
GetString(dynamicKey)), static source parsing cannot discover them automatically. Add them toManualTranslationswhen needed. - The built-in extraction pipeline reads metadata from fields in the default workflow. If your project relies on properties/methods, use custom extraction tooling or adapt the extractor.