C# Класс LocFileUtility, SmartLocalization

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
resXFileEnding string
rootLanguageFilePath string

Открытые методы

Метод Описание
AddNewKeyPersistent ( LocalizedObject>.Dictionary thisDictionary, string desiredKey, LocalizedObject, newValue ) : string

Adds a new key to a dictionary and does not stop until a unique key is found

AddNewKeyPersistent ( string>.Dictionary thisDictionary, string desiredKey, string newValue ) : string

Adds a new key to a dictionary and does not stop until a unique key is found

CheckAndCreateDirectory ( string path ) : void

Checks if the directory exist the and creates it if it doesn't

CheckAvailableLanguages ( List availableLanguages, List notAvailableLanguages, List notAvailableLanguagesEnglishNames ) : void

Checks the available languages.

CheckIfFileExists ( string filePath ) : bool

Checks if file exists.(Full filepath)

CheckIfLanguageFileExists ( string language ) : bool

Checks if language file exists.

CheckIfRootLanguageFileExists ( ) : bool

Checks if root language file exists.

CopyFileIntoResources ( SerializableLocalizationObjectPair, objectPair, CultureInfo thisCultureInfo ) : string

Copies the file into the resources folder. Naming the new asset to KEY

CreateNewLanguage ( string languageName ) : void

Creates a new language file with the keys from the root file.

CreateRootResourceFile ( ) : void

Creates the root resource file.

CreateSerializableLocalizationList ( LocalizedObject>.Dictionary languageValues ) : List

Creates the serializable localization list from the parsed LocalizedObjects

DeleteFileFromResources ( string key, CultureInfo thisCultureInfo ) : void

Deletes the localized file from resources.

DeleteLanguage ( CultureInfo cultureInfo ) : void

Deletes the language.

GetAvailableLanguages ( ) : List

Returns a list with all the available languages

GetFileExtension ( string fullFilePath ) : string

Gets the file extension from the full filePath

GetFileExtension ( string fileName, string relativeFolderPath ) : string

Gets the file extension for the file at the specified path

LoadAllAssets ( List thisLanguageValues ) : void

Loads all assets in language values if they have a valid file path

LoadLanguageFile ( string languageCode ) : string>.Dictionary

Loads the language file and returns the RAW values

LoadParsedLanguageFile ( string languageCode ) : LocalizedObject>.Dictionary

Loads the parsed language file.(without the type identifiers)

RenameFileFromResources ( string key, string newKey, CultureInfo thisCultureInfo ) : void

Renames the localized file from resources.

SaveLanguageFile ( string>.Dictionary languageValueDictionary, string filePath ) : void

Saves a language file(.resx) at the specified path containing the values in the languageValueDictionary

SaveRootLanguageFile ( string>.Dictionary changedRootKeys, string>.Dictionary changedRootValues ) : void

Saves the root language file and updates all the available languages.

Описание методов

AddNewKeyPersistent() публичный статический Метод

Adds a new key to a dictionary and does not stop until a unique key is found
public static AddNewKeyPersistent ( LocalizedObject>.Dictionary thisDictionary, string desiredKey, LocalizedObject, newValue ) : string
thisDictionary LocalizedObject>.Dictionary
desiredKey string
newValue LocalizedObject,
Результат string

AddNewKeyPersistent() публичный статический Метод

Adds a new key to a dictionary and does not stop until a unique key is found
public static AddNewKeyPersistent ( string>.Dictionary thisDictionary, string desiredKey, string newValue ) : string
thisDictionary string>.Dictionary
desiredKey string
newValue string
Результат string

CheckAndCreateDirectory() публичный статический Метод

Checks if the directory exist the and creates it if it doesn't
public static CheckAndCreateDirectory ( string path ) : void
path string
Результат void

CheckAvailableLanguages() публичный статический Метод

Checks the available languages.
public static CheckAvailableLanguages ( List availableLanguages, List notAvailableLanguages, List notAvailableLanguagesEnglishNames ) : void
availableLanguages List
notAvailableLanguages List
notAvailableLanguagesEnglishNames List
Результат void

CheckIfFileExists() публичный статический Метод

Checks if file exists.(Full filepath)
public static CheckIfFileExists ( string filePath ) : bool
filePath string /// If set to true file path. ///
Результат bool

CheckIfLanguageFileExists() публичный статический Метод

Checks if language file exists.
public static CheckIfLanguageFileExists ( string language ) : bool
language string /// If set to true language. ///
Результат bool

CheckIfRootLanguageFileExists() публичный статический Метод

Checks if root language file exists.
public static CheckIfRootLanguageFileExists ( ) : bool
Результат bool

CopyFileIntoResources() публичный статический Метод

Copies the file into the resources folder. Naming the new asset to KEY
public static CopyFileIntoResources ( SerializableLocalizationObjectPair, objectPair, CultureInfo thisCultureInfo ) : string
objectPair SerializableLocalizationObjectPair, /// Object pair. ///
thisCultureInfo CultureInfo
Результат string

CreateNewLanguage() публичный статический Метод

Creates a new language file with the keys from the root file.
public static CreateNewLanguage ( string languageName ) : void
languageName string /// The name of the language ///
Результат void

CreateRootResourceFile() публичный статический Метод

Creates the root resource file.
public static CreateRootResourceFile ( ) : void
Результат void

CreateSerializableLocalizationList() публичный статический Метод

Creates the serializable localization list from the parsed LocalizedObjects
public static CreateSerializableLocalizationList ( LocalizedObject>.Dictionary languageValues ) : List
languageValues LocalizedObject>.Dictionary /// Language values. ///
Результат List

DeleteFileFromResources() публичный статический Метод

Deletes the localized file from resources.
public static DeleteFileFromResources ( string key, CultureInfo thisCultureInfo ) : void
key string /// Key. ///
thisCultureInfo CultureInfo /// This culture info. ///
Результат void

DeleteLanguage() публичный статический Метод

Deletes the language.
public static DeleteLanguage ( CultureInfo cultureInfo ) : void
cultureInfo CultureInfo /// Culture info. ///
Результат void

GetAvailableLanguages() публичный статический Метод

Returns a list with all the available languages
public static GetAvailableLanguages ( ) : List
Результат List

GetFileExtension() публичный статический Метод

Gets the file extension from the full filePath
public static GetFileExtension ( string fullFilePath ) : string
fullFilePath string /// Full file path. ///
Результат string

GetFileExtension() публичный статический Метод

Gets the file extension for the file at the specified path
public static GetFileExtension ( string fileName, string relativeFolderPath ) : string
fileName string /// The file name without the extension. If the full name is for example hello.png, this parameter /// should be only "hello" ///
relativeFolderPath string /// The relative path to the folder containing the asset file /// relativeFolderPath should be relative to the project folder. Like: "Assets/MyTextures/". ///
Результат string

LoadAllAssets() публичный статический Метод

Loads all assets in language values if they have a valid file path
public static LoadAllAssets ( List thisLanguageValues ) : void
thisLanguageValues List
Результат void

LoadLanguageFile() публичный статический Метод

Loads the language file and returns the RAW values
public static LoadLanguageFile ( string languageCode ) : string>.Dictionary
languageCode string
Результат string>.Dictionary

LoadParsedLanguageFile() публичный статический Метод

Loads the parsed language file.(without the type identifiers)
public static LoadParsedLanguageFile ( string languageCode ) : LocalizedObject>.Dictionary
languageCode string /// Language code. ///
Результат LocalizedObject>.Dictionary

RenameFileFromResources() публичный статический Метод

Renames the localized file from resources.
public static RenameFileFromResources ( string key, string newKey, CultureInfo thisCultureInfo ) : void
key string /// Key. ///
newKey string
thisCultureInfo CultureInfo /// This culture info. ///
Результат void

SaveLanguageFile() публичный статический Метод

Saves a language file(.resx) at the specified path containing the values in the languageValueDictionary
public static SaveLanguageFile ( string>.Dictionary languageValueDictionary, string filePath ) : void
languageValueDictionary string>.Dictionary /// Language value dictionary. ///
filePath string /// File path. ///
Результат void

SaveRootLanguageFile() публичный статический Метод

Saves the root language file and updates all the available languages.
public static SaveRootLanguageFile ( string>.Dictionary changedRootKeys, string>.Dictionary changedRootValues ) : void
changedRootKeys string>.Dictionary
changedRootValues string>.Dictionary
Результат void

Описание свойств

resXFileEnding публичное статическое свойство

public static string resXFileEnding
Результат string

rootLanguageFilePath публичное статическое свойство

public static string rootLanguageFilePath
Результат string