MODULES Uize.Services.LocAdapter
- Contents
- 1. Introduction
-
2. Instance Methods
- 2.1. about
- 2.2. auditTranslations
- 2.3. diffLanguages
- 2.4. distributeResources
- 2.5. doesBrandSupportLanguage
- 2.6. export
- 2.7. exportJobs
- 2.8. extract
- 2.9. fire
- 2.10. gatherResources
- 2.11. get
- 2.12. getLanguageResourcePath
- 2.13. getLanguages
- 2.14. getReferencesFromCodeFile
- 2.15. getReferencingCodeFiles
- 2.16. getResourceFileBrand
- 2.17. getStringBrand
- 2.18. getTranslatableLanguages
- 2.19. import
- 2.20. importJobs
- 2.21. init
- 2.22. is
- 2.23. isBrandResourceFile
- 2.24. isBrandResourceString
- 2.25. isMet
- 2.26. isResourceFile
- 2.27. isStringKeyValid
- 2.28. isStringLong
- 2.29. isTokenWeak
- 2.30. isTranslatableString
- 2.31. kill
- 2.32. met
- 2.33. methodExecutionComplete
- 2.34. metrics
- 2.35. onChange
- 2.36. once
- 2.37. parseResourceFile
- 2.38. prepareToExecuteMethod
- 2.39. preview
- 2.40. pseudoLocalize
- 2.41. pseudoLocalizeString
- 2.42. serializeResourceFile
- 2.43. set
- 2.44. stepCompleted
- 2.45. stringHasHtml
- 2.46. toggle
- 2.47. unmet
- 2.48. unwire
- 2.49. usage
- 2.50. valueOf
- 2.51. whenever
- 2.52. wire
- 3. Instance Properties
-
4. Static Methods
- 4.1. Uize.Services.LocAdapter.alphastructor
- 4.2. Uize.Services.LocAdapter.declare
- 4.3. Uize.Services.LocAdapter.doMy
- 4.4. Uize.Services.LocAdapter.doesBrandSupportLanguage
- 4.5. Uize.Services.LocAdapter.dualContextMethods
- 4.6. Uize.Services.LocAdapter.dualContextProperties
- 4.7. Uize.Services.LocAdapter.fire
- 4.8. Uize.Services.LocAdapter.get
- 4.9. Uize.Services.LocAdapter.instanceMethods
- 4.10. Uize.Services.LocAdapter.instanceProperties
- 4.11. Uize.Services.LocAdapter.mixins
- 4.12. Uize.Services.LocAdapter.omegastructor
- 4.13. Uize.Services.LocAdapter.repairResourceFileStringsForTranslatableLanguage
- 4.14. Uize.Services.LocAdapter.resolveProjectLanguages
- 4.15. Uize.Services.LocAdapter.set
- 4.16. Uize.Services.LocAdapter.singleton
- 4.17. Uize.Services.LocAdapter.stateProperties
- 4.18. Uize.Services.LocAdapter.staticMethods
- 4.19. Uize.Services.LocAdapter.staticProperties
- 4.20. Uize.Services.LocAdapter.subclass
- 4.21. Uize.Services.LocAdapter.toggle
- 4.22. Uize.Services.LocAdapter.unwire
- 4.23. Uize.Services.LocAdapter.wire
- 5. Static Properties
1. Introduction
The Uize.Services.LocAdapter module defines a base class for adapters for the Uize.Services.Loc service.
DEVELOPERS: Chris van Rensburg
1.1. Examples
There are no dedicated showcase example pages for the Uize.Services.LocAdapter module.
SEARCH FOR EXAMPLES
Use the link below to search for example pages on the UIZE Web site that reference the Uize.Services.LocAdapter module...
SEARCH
1.2. Implementation Info
The Uize.Services.LocAdapter module defines the Uize.Services.LocAdapter class, which is a subclass of Uize.Service.Adapter.
INHERITANCE CHAIN
Uize.Class −> Uize.Service.Adapter −> Uize.Services.LocAdapter
1.2.1. Features Introduced in This Module
The features listed in this section have been introduced in this module.
INSTANCE METHODS
about | auditTranslations | diffLanguages | distributeResources | doesBrandSupportLanguage | export | exportJobs | extract | gatherResources | getLanguageResourcePath | getLanguages | getReferencesFromCodeFile | getReferencingCodeFiles | getResourceFileBrand | getStringBrand | getTranslatableLanguages | import | importJobs | init | isBrandResourceFile | isBrandResourceString | isResourceFile | isStringKeyValid | isStringLong | isTokenWeak | isTranslatableString | methodExecutionComplete | metrics | parseResourceFile | prepareToExecuteMethod | preview | pseudoLocalize | pseudoLocalizeString | serializeResourceFile | stepCompleted | stringHasHtml | usage
INSTANCE PROPERTIES
STATIC METHODS
Uize.Services.LocAdapter.doesBrandSupportLanguage | Uize.Services.LocAdapter.repairResourceFileStringsForTranslatableLanguage | Uize.Services.LocAdapter.resolveProjectLanguages
1.2.2. Features Overridden in This Module
The features listed in this section have been overridden in this module.
The module that an overridden feature was initially introduced in will be noted in the IMPLEMENTATION INFO notes for the feature.
INSTANCE METHODS
STATIC PROPERTIES
Uize.Services.LocAdapter.moduleName | Uize.Services.LocAdapter.nonInheritableStatics
1.2.3. Features Inherited From Other Modules
The features listed in this section have been inherited from other modules.
The module that an inherited feature was initially introduced in will be noted in the IMPLEMENTATION INFO notes for the feature.
INSTANCE METHODS
fire | get | is | isMet | kill | met | onChange | once | set | toggle | unmet | unwire | whenever | wire
STATIC METHODS
Uize.Services.LocAdapter.alphastructor | Uize.Services.LocAdapter.declare | Uize.Services.LocAdapter.doMy | Uize.Services.LocAdapter.dualContextMethods | Uize.Services.LocAdapter.dualContextProperties | Uize.Services.LocAdapter.fire | Uize.Services.LocAdapter.get | Uize.Services.LocAdapter.instanceMethods | Uize.Services.LocAdapter.instanceProperties | Uize.Services.LocAdapter.mixins | Uize.Services.LocAdapter.omegastructor | Uize.Services.LocAdapter.set | Uize.Services.LocAdapter.singleton | Uize.Services.LocAdapter.stateProperties | Uize.Services.LocAdapter.staticMethods | Uize.Services.LocAdapter.staticProperties | Uize.Services.LocAdapter.subclass | Uize.Services.LocAdapter.toggle | Uize.Services.LocAdapter.unwire | Uize.Services.LocAdapter.wire
STATIC PROPERTIES
1.2.4. Modules Directly Under This Namespace
1.2.5. Unit Tests
The Uize.Services.LocAdapter module is unit tested by the Uize.Test.Uize.Services.LocAdapter test module.
2. Instance Methods
2.1. about
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.2. auditTranslations
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.3. diffLanguages
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.4. distributeResources
Distributes the resource strings from the specified project resource strings object to a project's codebase as resource files.
SYNTAX
this.distributeResources (stringResourcesOBJ,languageSTR);
The distributeResources method iterates through the project resource strings object passed to it and uses the serializeResourceFile instance method to generate the contents for resource files that are then written to the codebase of the project. A language identifier should be passed to the languageSTR parameter so that the distributeResources method can know for which language resource files are to be generated - this information will govern the naming of the generated files.
In addition to being used internally in the implementation of the import localization service method, the distributeResources method can be used in the implementation of the extract localization service method for generating resource files for the primary language, based upon resource strings that have been extracted from the project's source code files.
NOTES
see the related serializeResourceFile instance method |
|
see also the companion gatherResources instance method |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.5. doesBrandSupportLanguage
Returns a boolean, indicating whether or not the specified brand supports the specified language.
SYNTAX
supportsLanguageBOOL = this.doesBrandSupportLanguage (brandIdSTR,languageSTR);
Whether or not a particular language is supported for a brand is governed by the brand language configuration for a project. Internally, the doesBrandSupportLanguage method is used in the implementation of the export localization service method to determine if branded resource strings should be gathered for any given translatable language for which strings are being exported.
If an empty string is specified for the brandIdSTR parameter, or if the language identifier for the pseudo-locale that is configured for the project is specified for the languageSTR parameter, then the doesBrandSupportLanguage method will return the value true.
NOTES
see the related getResourceFileBrand and getStringBrand instance methods |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.6. export
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.7. exportJobs
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.8. extract
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.9. fire
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
2.10. gatherResources
Returns a project resource strings object, being the complete set of resource strings for the primary language of a project, as parsed from all the primary language resource files of the project.
SYNTAX
stringResourcesOBJ = this.gatherResources ();
The gatherResources method recurses through all the folders under the configured root folder path for a project, finding all the resource files (as determined by the isResourceFile instance method), and parses the resource strings from these files using the parseResourceFile instance method. The parsed resource strings are populated into the master project resource strings object.
NOTES
see the related isResourceFile and parseResourceFile instance methods |
|
see also the companion distributeResources instance method |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.11. get
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
2.12. getLanguageResourcePath
Returns a string, representing the file path for a language specific version of the specified primary language resource file.
SYNTAX
resourcePathSTR = this.getLanguageResourcePath (primaryLanguageResourcePathSTR,languageSTR);
The primaryLanguageResourcePathSTR parameter is used to specify the path for the primary language version of a specific resource file, while the languageSTR parameter is used to specify the language for which a language specific resource file path should be generated.
The implementation of the getLanguageResourcePath method should take the values for these two parameters and then use the project specific rules for resource file naming and organization to derive the path for the language specific version of the resource file and return this path.
The getLanguageResourcePath method is used when generating resource files in the codebase for all the translatable languages configured for a project. This method must be overridden by subclasses, since the base class' version contains no implementation and will throw an exception if called.
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.13. getLanguages
Returns an array, containing the locale codes for all the languages configured for the project, including the primary language and the pseudo-locale.
SYNTAX
languagesARRAY = this.getLanguages ();
NOTES
compare to the related getTranslatableLanguages instance method |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.14. getReferencesFromCodeFile
Returns a string references lookup object, representing the information for zero or more resource string references detected within the specified code file.
SYNTAX
stringReferencesOBJ = this.getReferencesFromCodeFile (filePathSTR);
The usage method iterates over the list of referencing files that is returned by the getReferencingCodeFiles instance method and, for each file, uses the getReferencesFromCodeFile instance method to obtain the file's resource string references.
The implementation of this method, provided in this base class, throws an error. This means that, if the usage localization service method is to be used for a project, then this method must be overridden by the adapter subclass for the project.
When the getReferencesFromCodeFile method is called, the file path for a code file is passed to its filePathSTR parameter. As an instance method, an implementation for this method can access the project properties through the properties of the instance.
The implementation can detect resource string references in any way that suits the nature of the project and the language(s) of its code files. The only requirement is that the method return a lookup object of string references arrays, where the keys of the lookup object are string ID's, and where the values of the lookup are references arrays containing any number of reference info objects describing the references to the string within the code file.
STRING REFERENCES LOOKUP OBJECT
{
myString1:[
{
// reference info
},
{
// reference info
},
...
],
myString2:[
{
// reference info
},
{
// reference info
},
...
],
...
...
...
myStringN:[
{
// reference info
},
{
// reference info
},
...
]
}
The information that is returned in the string reference objects is left to the discretion of the adapter subclass for the project. The following structure is recommended as a guideline...
STRING REFERENCE OBJECT
{
reference:referenceTextSTR,
start:{
line:startLineINT, // the line number where the reference starts
lineChar:startLineCharINT, // the starting character on the starting line
char:startCharINT // the starting character within the file
},
end:{
line:endLineINT, // the line number where the reference ends
lineChar:endLineCharINT, // the ending character on the ending line
char:endCharINT // the ending character within the file
}
}
NOTES
see also the related usage and getReferencingCodeFiles instance methods |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.15. getReferencingCodeFiles
Returns an array of file paths, representing the code files in a project's codebase that may contain references to resource strings.
SYNTAX
filePathsARRAY = this.getReferencingCodeFiles ();
The implementation of this method, provided in this base class, throws an error. This means that, if the usage localization service method is to be used for a project, then this method must be overridden by the adapter subclass for the project.
The getReferencingCodeFiles method is not passed any parameters when it is called. As an instance method, an implementation for this method can access the project properties through the properties of the instance. The implementation can determine the list of referencing files in any way that suits the nature of the project. The only requirement is that the method return an array of file paths.
The usage method iterates over the list of referencing files that is returned by this method and, for each file, uses the getReferencesFromCodeFile instance method to obtain the file's resource string references.
NOTES
see also the related usage and getReferencesFromCodeFile instance methods |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.16. getResourceFileBrand
Returns a string, representing the brand ID for the specified resource file, or an empty string if the resource file is brand-neutral.
SYNTAX
brandIdSTR = this.getResourceFileBrand (resourceFilePathSTR);
The implementation of this method, provided in this base class, simply returns an empty string. This method can be optionally overridden by subclasses, for projects that support branded resources.
NOTES
compare to the related getStringBrand instance method |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.17. getStringBrand
Returns a string, representing the brand ID for the specified resource string, or an empty string if the resource string is brand-neutral.
SYNTAX
brandIdSTR = this.getStringBrand (stringPathARRAY);
The implementation of this method, provided in this base class, simply returns an empty string. This method can be optionally overridden by subclasses, for projects that support branded resources.
When the getStringBrand method is called, a value is passed for the stringPathARRAY parameter that specifies the full path to the string, where the first element in the path array specifies the path for the resource file to which the string belongs, and the remaining elements of the path array specify the location of the string internal to the resource file (this may consist of simply a key element, or multiple elements if the resource files for a project are hierarchical rather than flat).
NOTES
compare to the related getResourceFileBrand instance method |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.18. getTranslatableLanguages
Returns an array, containing the locale codes for all the translatable languages configured for the project (i.e. excluding the primary language and the pseudo-locale).
SYNTAX
translatableLanguagesARRAY = this.getTranslatableLanguages ();
NOTES
compare to the related getLanguages instance method |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.19. import
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.20. importJobs
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.21. init
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.22. is
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
2.23. isBrandResourceFile
Returns a boolean, indicating whether or not the specified file path is for a brand resource file.
SYNTAX
isBrandResourceFileBOOL = this.isBrandResourceFile (filePathSTR);
The implementation of this method, provided in this base class, leverages the related getResourceFileBrand instance method and returns true if the value returned by the getResourceFileBrand method is truthy. This method can be optionally overridden by subclasses to determine if a resource file is for a brand in a different manner.
NOTES
see also the related getResourceFileBrand instance method |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.24. isBrandResourceString
Returns a boolean, indicating whether or not the specified resource string is for a brand.
SYNTAX
isBrandResourceStringBOOL = this.isBrandResourceString (resourceStringPathARRAY);
The implementation of this method, provided in this base class, leverages the related getStringBrand instance method and returns true if the value returned by the getStringBrand method is truthy.
This method can be optionally overridden by subclasses, if it is necessary to determine if a resource string is for a brand in some different manner. When the isBrandResourceString method is called, it is passed a value for the resourceStringPathARRAY parameter that is a path array, where the last element can be regarded as the string key. An implementation for this method may use any elements of the path array to determine whether or not the string is for a brand.
NOTES
see also the related getStringBrand instance method |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.25. isMet
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
2.26. isResourceFile
Returns a boolean, indicating whether or not the specified file is a resource file.
SYNTAX
isResourceFileBOOL = this.isResourceFile (filePathSTR);
The implementation of this method, provided in this base class, throws an error. This means that this method must be overridden by an adapter subclass for a project.
When the isResourceFile method is called, it is passed a value for the filePathSTR parameter that specifies the path for the file being tested, that is relative to the configured root folder path for the project.
An implementation for this method can perform any test against the file path to determine whether or not the file is a resource file. Assuming that a project follows a sensible naming convention for resource files, it is quite reasonable to use a regular epxression based match.
NOTES
see also the related isBrandResourceFile and getResourceFileBrand instance methods |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.27. isStringKeyValid
Returns a boolean, indicating whether or not a string's key is valid.
SYNTAX
isValidBOOL = this.isStringKeyValid (stringPathARRAY);
The implementation of this method, provided in this base class, always returns the value true.
When the isStringKeyValid method is called, a value is passed for the stringPathARRAY parameter that specifies the full path to the string. Generally, the key is considered to be the very last element in the string path array, but an implementation of this method can use any or all of the elements of the path array to determine if the string's "key" is valid.
NOTES
the result returned by this method is used by the metrics method when producing its metrics report |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.28. isStringLong
Returns a boolean, indicating whether or not a string is considered to be long.
SYNTAX
isLongBOOL = this.isStringLong (stringMetricsOBJ);
The implementation of this method, provided in this base class, judges a string to be long if it contains more than 50 words or more than 500 characters.
When the isStringLong method is called, a string metrics object is passed as a value to the stringMetricsOBJ parameter. The string metrics object is generated by the Uize.Loc.Strings.Metrics.getStringMetrics method of the Uize.Loc.Strings.Metrics module and contains information on the word count and character count of the string. This information can be used in the implementation of the isStringLong method.
NOTES
the result returned by this method is used by the metrics method when producing its metrics report |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.29. isTokenWeak
Returns a boolean, indicating whether or not the name of a substitution token is considered weak.
SYNTAX
isWeakBOOL = this.isTokenWeak (tokenNameSTR);
The implementation of this method, provided in this base class, judges the name of a token to be weak if it is less than three characters in length, or if it is a number.
When the isTokenWeak method is called, the name of a token to test is passed to the tokenNameSTR parameter. An implementation of this method can use any criteria suitable to the project to determine whether or not a token name is weak.
NOTES
the result returned by this method is used by the metrics method when producing its metrics report |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.30. isTranslatableString
Returns a boolean, indicating whether or not the specified string is translatable.
SYNTAX
isTranslatableBOOL = this.isTranslatableString (stringInfoOBJ);
The implementation of this method, provided in this base class, always returns the value true. If the resource files for a project are expected to contain any strings that should never be translated, then this method should be overridden in an adapter subclass for the project to return the value false for such strings.
When the isTranslatableString method is called, a value is passed for the stringInfoOBJ parameter that provides information about the string and is of the form...
STRING INFO
{
key:keySTR, // the key of the string path
value:valueSTR // the text of the string
}
2.30.1. Techniques for Determining Translatability
An implementation of the isTranslatableString method can use any criteria suitable to the project to determine whether or not a given string is translatable.
In one approach, a special naming convention could be used for string keys to indicate strings that should not be translated, and then the implementation of this method can perform a test using the value of the key property of the string info object.
Alternatively, or in addition to, the text of the string can be used to determine whether or not it is translatable. For example, a regular expression based match could be used to detect strings whose values are URLs, phone numbers, e-mail addresses, etc. that should not be translated.
2.30.2. How the Result is Used
The value returned by the isTranslatableString method is used to determine whether or not a string's value should be pseudo-localized by the pseudoLocalizeString instance method, and whether or not a string's value should be exported into translation jobs by the exportJobs instance method.
2.30.3. Pure Whitespace is Not Translatable
The isTranslatableString method is never called for strings whose values are either empty or pure whitespace (containing no non-whitespace characters).
It is not often that the value of a string for the primary language of a project is pure whitespace, but this does occur from time to time. In such cases, these strings are always considered non-translatable.
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.31. kill
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
2.32. met
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
2.33. methodExecutionComplete
Informs the method progress logger of the completion of a localization service method's execution.
SYNTAX
this.methodExecutionComplete (summarySTR);
The methodExecutionComplete method is used internally in the implementations for localization service methods, such as the export method. When used, it should be called after all steps in the execution of a method have been completed. A string value should be passed for the summarySTR parameter, so that summary information can be logged for the method.
NOTES
see the related prepareToExecuteMethod and stepCompleted instance methods |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.34. metrics
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.35. onChange
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
2.36. once
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
2.37. parseResourceFile
Returns a resource strings object, being the resource strings parsed from the specified resource file.
SYNTAX
resourceStringsOBJ = this.parseResourceFile (resourceFileTextSTR,resourceFileInfoOBJ);
The implementation of this method, provided in this base class, throws an error. This means that this method must be overridden by an adapter subclass for a project.
When the parseResourceFile method is called, two parameters are passed to it: resourceFileTextSTR and resourceFileInfoOBJ.
2.37.1. resourceFileTextSTR
A string, representing the text contents of the resource file being parsed.
2.37.2. resourceFileInfoOBJ
An object, providing additional information about the resource file being parsed, of the form...
RESOURCE FILE INFO
{
path:filePathSTR,
language:localeSTR,
isPrimaryLanguage:isPrimaryLanguageBOOL
}
An implementation of the parseResourceFile method can optionally use any or all of the information contained inside the resource file info object to conditionalize how a resource file is parsed.
2.37.2.1. Primary Language Value Defaulting
Some resource file formats follow a convention of using the text for the primary language version of resource strings as string keys, and often the values in the primary language resource files are left blank.
But, to satisfy the needs of the localization service adapter, string values must not be empty for internal operations. In such cases, then, the implementation of the parseResourceFile method in the adapter subclass for the project can default the values to the keys when parsing the resource files for the primary language, but not perform this defaulting behavior for resource files for the translatable languages.
NOTES
see the companion serializeResourceFile instance method |
|
the parseResourceFile method is used in the implementations of the gatherResources and export instance methods |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.38. prepareToExecuteMethod
Prepares the method progress logger to expect the specified number of total steps to be performed during execution of a method.
SYNTAX
this.prepareToExecuteMethod (totalStepsINT);
The prepareToExecuteMethod method is used internally in the implementations for localization service methods, such as the export method. When used, it should be called early in the execution of a localization method, after the scope of the method's work has been determined, but before any of the work has been performed. Thereafter, the related stepCompleted and methodExecutionComplete methods should be used.
NOTES
see the related stepCompleted and methodExecutionComplete instance methods |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.39. preview
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.40. pseudoLocalize
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.41. pseudoLocalizeString
Returns a string, being a pseudo-localized version of the specified resource string.
SYNTAX
pseudoLocalizedSTR = this.pseudoLocalizeString (stringInfoOBJ,pseudoLocalizationOptionsOBJ);
When the resource strings for a project are exported using the export localization service method, pseudo-localized values for all translatable strings are automatically generated for the configured pseudo-locale of the project. These pseudo-localized values are created by calling the pseudoLocalizeString method.
The implementation of this method, provided in this base class, pseudo-localizes resource strings by calling the Uize.Loc.Pseudo.pseudoLocalize method of the Uize.Loc.Pseudo module. This behavior is generally adequate for most projects. However, the implementation of this method can optionally be overridden in an adapter subclass for a project if any kind of special handling might be needed for specific strings, or if a different process of pseudo-localization needs to be employed.
When the pseudoLocalizeString method is called, two parameters are passed to it: stringInfoOBJ and stringValueSTR.
2.41.1. stringInfoOBJ
An object that provides information about the string, of the form...
STRING INFO
{
key:keySTR, // the key of the string path
value:valueSTR, // the text of the string
path:pathSTR // the full path of the resource string
}
An implementation of this method can optionally use the values of the key or path properties of the string info object to conditionalize how pseudo-localized versions of resource strings should be derived from the value property of the string info object.
2.41.2. pseudoLocalizationOptionsOBJ
An object, containing the configured pseudo-localization options for the project.
The properties of this options object will depend upon the configuration of the project and the pseudo-localization process being used.
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.42. serializeResourceFile
Returns a string, being the specified resource strings object serialized to the text contents of a resource file.
SYNTAX
resourceFileTextSTR = this.serializeResourceFile (resourceStringsOBJ,resourceFileInfoOBJ);
The implementation of this method, provided in this base class, throws an error. This means that this method must be overridden by an adapter subclass for a project.
When the serializeResourceFile method is called, two parameters are passed to it: resourceStringsOBJ and resourceFileInfoOBJ.
2.42.1. resourceStringsOBJ
An object, containing the resource strings that should be serialized to produce the resulting resource file text.
2.42.2. resourceFileInfoOBJ
An object, providing additional information about the resource file being serialized, of the form...
RESOURCE FILE INFO
{
path:filePathSTR,
language:localeSTR,
isPrimaryLanguage:isPrimaryLanguageBOOL
}
An implementation of the serializeResourceFile method can optionally use any or all of the information contained inside the resource file info object to conditionalize how a resource file is serialized.
In particular, certain resource file formats may require that the language of the strings contained inside a file be specified in some internal markup inside the file, such as in an XML tag attribute. Using the value of the language property of the resource file info object, the serializer can represent the language in the serialized resource file text in whatever way is appropriate for the resource file format being used by a project.
NOTES
see the companion parseResourceFile instance method |
|
the serializeResourceFile method is used in the implementation of the distributeResources instance method |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.43. set
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
2.44. stepCompleted
Informs the method progress logger of the completion of one of the steps of a localization service method's execution.
SYNTAX
this.stepCompleted (messageSTR);
The stepCompleted method is used internally in the implementations for localization service methods, such as the export method. When used, it should be called during the execution of a localization service method, exactly as many times as the number of total steps specified when earlier calling the prepareToExecuteMethod method. A string value should be passed for the messageSTR parameter, so that information about the step that has been completed can be logged.
NOTES
see the related prepareToExecuteMethod and methodExecutionComplete instance methods |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.45. stringHasHtml
Returns a boolean, indicating whether or not the specified string contains HTML tags.
SYNTAX
hasHtmlBOOL = this.stringHasHtml (stringPathARRAY,stringValueSTR);
The implementation of this method, provided in this base class, performs a very simple (and performant), regular expression match based test to determine if a string contains HTML tags. Some projects may use a format for substitution tokens that resembles the HTML tag format, and this may confuse the test in the base class' implementation of this method. In such cases, this method can be overridden in a subclass.
When the stringHasHtml method is called, two parameters are passed to it: stringPathARRAY and stringValueSTR.
2.45.1. stringPathARRAY
An array, specifying the full path to the string.
The path can be used to determine if a string contains HTML if the project organizes resource strings in such a way that strings that contain HTML are either separated in some way from those that don't, or if some naming convention is used for the string keys (or other elements of the string path array) to indicate that a string contains HTML.
2.45.2. stringValueSTR
A string, representing the actual text of the resource string.
With the value of a resource string, a regular expression match or other form of test (such as HTML parsing) can be performed to determine if the string contains HTML tags.
NOTES
the result returned by this method is used by the metrics method when producing its metrics report |
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.46. toggle
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
2.47. unmet
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
2.48. unwire
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
2.49. usage
IMPLEMENTATION INFO
| this feature was introduced in this module |
2.50. valueOf
this is an override of an inherited feature (implementation is in this module, first introduced in Uize.Class) |
IMPLEMENTATION INFO
2.51. whenever
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
2.52. wire
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
3. Instance Properties
3.1. tokenRegExp
IMPLEMENTATION INFO
| this feature was introduced in this module |
3.2. wordSplitter
IMPLEMENTATION INFO
| this feature was introduced in this module |
4. Static Methods
4.1. Uize.Services.LocAdapter.alphastructor
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.2. Uize.Services.LocAdapter.declare
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.3. Uize.Services.LocAdapter.doMy
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.4. Uize.Services.LocAdapter.doesBrandSupportLanguage
IMPLEMENTATION INFO
| this feature was introduced in this module | |
| this static feature is inherited by subclasses |
4.5. Uize.Services.LocAdapter.dualContextMethods
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.6. Uize.Services.LocAdapter.dualContextProperties
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.7. Uize.Services.LocAdapter.fire
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.8. Uize.Services.LocAdapter.get
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.9. Uize.Services.LocAdapter.instanceMethods
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.10. Uize.Services.LocAdapter.instanceProperties
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.11. Uize.Services.LocAdapter.mixins
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.12. Uize.Services.LocAdapter.omegastructor
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.13. Uize.Services.LocAdapter.repairResourceFileStringsForTranslatableLanguage
IMPLEMENTATION INFO
| this feature was introduced in this module | |
| this static feature is inherited by subclasses |
4.14. Uize.Services.LocAdapter.resolveProjectLanguages
IMPLEMENTATION INFO
| this feature was introduced in this module | |
| this static feature is inherited by subclasses |
4.15. Uize.Services.LocAdapter.set
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.16. Uize.Services.LocAdapter.singleton
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.17. Uize.Services.LocAdapter.stateProperties
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.18. Uize.Services.LocAdapter.staticMethods
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.19. Uize.Services.LocAdapter.staticProperties
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.20. Uize.Services.LocAdapter.subclass
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.21. Uize.Services.LocAdapter.toggle
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.22. Uize.Services.LocAdapter.unwire
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
4.23. Uize.Services.LocAdapter.wire
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
5. Static Properties
5.1. Uize.Services.LocAdapter.moduleName
IMPLEMENTATION INFO
this is an override of an inherited feature (implementation is in this module, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |
5.2. Uize.Services.LocAdapter.nonInheritableStatics
IMPLEMENTATION INFO
this is an override of an inherited feature (implementation is in this module, first introduced in Uize.Class) |
|
| this static feature is not inherited by subclasses |
5.3. Uize.Services.LocAdapter.pathToResources
Inherited from Uize.Class.
IMPLEMENTATION INFO
this is an inherited feature (implementation is in Uize.Class, first introduced in Uize.Class) |
|
| this static feature is inherited by subclasses |