C# Class LocFileUtility, SmartLocalization

ファイルを表示 Open project: NiklasBorglund/SmartLocalization Class Usage Examples

Public Properties

Property Type Description
resXFileEnding string
rootLanguageFilePath string

Public Methods

Method Description
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.

Method Details

AddNewKeyPersistent() public static method

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,
return string

AddNewKeyPersistent() public static method

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
return string

CheckAndCreateDirectory() public static method

Checks if the directory exist the and creates it if it doesn't
public static CheckAndCreateDirectory ( string path ) : void
path string
return void

CheckAvailableLanguages() public static method

Checks the available languages.
public static CheckAvailableLanguages ( List availableLanguages, List notAvailableLanguages, List notAvailableLanguagesEnglishNames ) : void
availableLanguages List
notAvailableLanguages List
notAvailableLanguagesEnglishNames List
return void

CheckIfFileExists() public static method

Checks if file exists.(Full filepath)
public static CheckIfFileExists ( string filePath ) : bool
filePath string /// If set to true file path. ///
return bool

CheckIfLanguageFileExists() public static method

Checks if language file exists.
public static CheckIfLanguageFileExists ( string language ) : bool
language string /// If set to true language. ///
return bool

CheckIfRootLanguageFileExists() public static method

Checks if root language file exists.
public static CheckIfRootLanguageFileExists ( ) : bool
return bool

CopyFileIntoResources() public static method

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
return string

CreateNewLanguage() public static method

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 ///
return void

CreateRootResourceFile() public static method

Creates the root resource file.
public static CreateRootResourceFile ( ) : void
return void

CreateSerializableLocalizationList() public static method

Creates the serializable localization list from the parsed LocalizedObjects
public static CreateSerializableLocalizationList ( LocalizedObject>.Dictionary languageValues ) : List
languageValues LocalizedObject>.Dictionary /// Language values. ///
return List

DeleteFileFromResources() public static method

Deletes the localized file from resources.
public static DeleteFileFromResources ( string key, CultureInfo thisCultureInfo ) : void
key string /// Key. ///
thisCultureInfo CultureInfo /// This culture info. ///
return void

DeleteLanguage() public static method

Deletes the language.
public static DeleteLanguage ( CultureInfo cultureInfo ) : void
cultureInfo CultureInfo /// Culture info. ///
return void

GetAvailableLanguages() public static method

Returns a list with all the available languages
public static GetAvailableLanguages ( ) : List
return List

GetFileExtension() public static method

Gets the file extension from the full filePath
public static GetFileExtension ( string fullFilePath ) : string
fullFilePath string /// Full file path. ///
return string

GetFileExtension() public static method

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/". ///
return string

LoadAllAssets() public static method

Loads all assets in language values if they have a valid file path
public static LoadAllAssets ( List thisLanguageValues ) : void
thisLanguageValues List
return void

LoadLanguageFile() public static method

Loads the language file and returns the RAW values
public static LoadLanguageFile ( string languageCode ) : string>.Dictionary
languageCode string
return string>.Dictionary

LoadParsedLanguageFile() public static method

Loads the parsed language file.(without the type identifiers)
public static LoadParsedLanguageFile ( string languageCode ) : LocalizedObject>.Dictionary
languageCode string /// Language code. ///
return LocalizedObject>.Dictionary

RenameFileFromResources() public static method

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. ///
return void

SaveLanguageFile() public static method

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. ///
return void

SaveRootLanguageFile() public static method

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
return void

Property Details

resXFileEnding public_oe static_oe property

public static string resXFileEnding
return string

rootLanguageFilePath public_oe static_oe property

public static string rootLanguageFilePath
return string