docs.unity3d.com
    目次を表示する/隠す

    Class XliffDocument

    Provides the ability to interact with XLIFF files.

    Inheritance
    Object
    XliffDocument
    Namespace: UnityEditor.Localization.Plugins.XLIFF
    Syntax
    public static class XliffDocument
    Examples

    This shows how to create an XLIFF document, populate it with values to translate, and then write it to file.

        var document = XliffDocument.Create(XliffVersion.V20);
    
        // The lnaguage to translate from.
        document.SourceLanguage = "en";
    
        // The language to translate into.
        document.TargetLanguage = "fr";
    
        var file = document.AddNewFile();
        file.Id = "file id";
    
        var group = file.AddNewGroup();
    
        var start = group.AddNewTranslationUnit();
        start.Id = "12345";
        start.Name = "START";
        start.Source = "Start Game";
    
        var quit = group.AddNewTranslationUnit();
        quit.Id = "12346";
        quit.Name = "QUIT";
        quit.Source = "Quit Game";
    
        using (var stream = new FileStream("Exported XLIFF.xliff", FileMode.Create, FileAccess.Write))
        {
            document.Serialize(stream);
        }

    Methods

    Create(XliffVersion)

    Creates a new XLIFF file with the requested version.

    Declaration
    public static IXliffDocument Create(XliffVersion version)
    Parameters
    Type Name Description
    XliffVersion version

    The XLIFF version to target.

    Returns
    Type Description
    IXliffDocument

    The new XLIFF file.

    Parse(Stream)

    Converts and XLIFF stream into a parsed document.

    Declaration
    public static IXliffDocument Parse(Stream stream)
    Parameters
    Type Name Description
    Stream stream

    The XLIFF stream.

    Returns
    Type Description
    IXliffDocument

    The parsed XLIFF document.

    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)