• Lexical
Show / Hide Table of Contents
  • Lexical.FileSystem
    • Introduction
    • Abstractions
      • IFileSystem
        • IFileSystem
        • IFileSystemBrowse
        • IFileSystemCreateDirectory
        • IFileSystemDelete
        • IFileSystemFileAttribute
        • IFileSystemMount
        • IFileSystemMove
        • IFileSystemObserve
        • IFileSystemOpen
      • IEvent
      • IEntry
      • IOption
      • IToken
    • FileSystem
    • VirtualFileSystem
    • MemoryFileSystem
    • EmbeddedFileSystem
    • HttpFileSystem
    • Decoration
    • IFileProvider
    • Utility
      • DisposeList
      • FileScanner
      • VisitTree
      • File Operation
  • Lexical.FileProvider
    • Introduction
    • Package
    • Package.Abstractions
    • Root
    • Zip
    • Dll
    • SharpCompress
    • SharpZipLib
    • FileScanner
    • Utils
  • Lexical.Localization
    • Introduction
    • Tutorial
    • Asset
      • IAsset
      • IStringAsset
    • Line
      • ILine
      • ILineFactory
      • ILineRoot
      • ILineFormat
      • ILineLogger
      • LineComparer
    • File
      • ILineReader
      • ILineWriter
      • Ini
      • Json
      • Xml
      • Resx
      • Resources
    • Miscellaneous
      • Plurality
      • ICulturePolicy
      • IStringFormat
      • Dependency Injection
    • Practices
      • Class Library
      • Class Library DI
      • Class Library DI opt.
  • Lexical.Utilities
    • Introduction
    • UnicodeString
    • FileScanner
    • Permutation
    • Tuples
    • StructList

Xml File

Example of .xml localization file.

<?xml version="1.0" encoding="UTF-8"?>
<Localization xmlns:Culture="urn:lexical.fi:Culture" 
              xmlns:Type="urn:lexical.fi:Type" 
              xmlns:Key="urn:lexical.fi:Key">
  <Type:ConsoleApp1.MyController>
    <Key:Success>Success</Key:Success>
    <Key:Error>Error (Code=0x{0:X8})</Key:Error>
  </Type:ConsoleApp1.MyController>
  <Culture:en>
    <Type:ConsoleApp1.MyController>
      <Key:Success>Success</Key:Success>
      <Key:Error>Error (Code=0x{0:X8})</Key:Error>
    </Type:ConsoleApp1.MyController>
  </Culture:en>
  <Culture:fi>
    <Type:ConsoleApp1.MyController>
      <Key:Success>Onnistui</Key:Success>
      <Key:Error>Virhe (Koodi=0x{0:X8})</Key:Error>
    </Type:ConsoleApp1.MyController>
  </Culture:fi>
</Localization>

Keys can be defined with attributes.

<?xml version="1.0" encoding="UTF-8"?>
<Localization xmlns:Culture="urn:lexical.fi:Culture">
  <Culture:sv Type="ConsoleApp1.MyController" Key="Success">Det Funkar</Culture:sv>
  <Culture:sv Type="ConsoleApp1.MyController" Key="Error">Det funkar inte (Kod=0x{0:X8})</Culture:sv>
</Localization>

And with "Line" node.

<?xml version="1.0" encoding="UTF-8"?>
<Localization xmlns="urn:lexical.fi">
  <Line Culture="sv" Type="ConsoleApp1.MyController" Key="Success">Det Funkar</Line>
  <Line Culture="sv" Type="ConsoleApp1.MyController" Key="Error">Det funkar inte (Kod=0x{0:X8})</Line>
</Localization>
Back to top Copyright © 2015-2020 Toni Kalajainen