From: Peter T. <pe...@us...> - 2003-07-13 21:55:22
|
Update of /cvsroot/jvcl/dev/help In directory sc8-pr-cvs1:/tmp/cvs-serv31031/help Modified Files: JvTranslator.dtx Log Message: - First commit. Remko, Marcel: please check that I haven't botched this totally since I don't have tools to check how it will look. Index: JvTranslator.dtx =================================================================== RCS file: /cvsroot/jvcl/dev/help/JvTranslator.dtx,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JvTranslator.dtx 13 Jul 2003 20:00:10 -0000 1.4 --- JvTranslator.dtx 13 Jul 2003 21:55:19 -0000 1.5 *************** *** 15,172 **** FLAG=Component Summary ! Write here a summary (1 line) Description ! Write here a description ---------------------------------------------------------------------------------------------------- ! @@TJvTranslator.ComponentToXML Summary ! Write here a summary (1 line) Description ! Write here a description Parameters ! AComponent - Description for this parameter ! Recurse - Description for this parameter Return value ! Describe here what the function returns See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslator.InSkipList@TClass Summary ! Write here a summary (1 line) Description ! Write here a description ! This is an overloaded function/procedure, if possible you may combine the description ! of all these functions into 1 general description. If you do so, combine all "Parameter" ! lists into 1 list, and leave the "Summary", "Description" etc. fields empty for all ! other overloaded functions with the same name. Parameters ! AClass - Description for this parameter Return value ! Describe here what the function returns See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslator.SkipClass Summary ! Write here a summary (1 line) Description ! Write here a description Parameters ! AClass - Description for this parameter See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslator.Translate@string Summary ! Write here a summary (1 line) Description ! Write here a description ! This is an overloaded function/procedure, if possible you may combine the description ! of all these functions into 1 general description. If you do so, combine all "Parameter" ! lists into 1 list, and leave the "Summary", "Description" etc. fields empty for all ! other overloaded functions with the same name. Parameters ! FileName - Description for this parameter ! See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslator.Translate@string@string Summary ! Write here a summary (1 line) Description ! Write here a description ! This is an overloaded function/procedure, if possible you may combine the description ! of all these functions into 1 general description. If you do so, combine all "Parameter" ! lists into 1 list, and leave the "Summary", "Description" etc. fields empty for all ! other overloaded functions with the same name. Parameters ! Category - Description for this parameter ! Item - Description for this parameter Return value ! Describe here what the function returns ! See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslator.Translate@string@TCustomForm Summary ! Write here a summary (1 line) Description ! Write here a description ! This is an overloaded function/procedure, if possible you may combine the description ! of all these functions into 1 general description. If you do so, combine all "Parameter" ! lists into 1 list, and leave the "Summary", "Description" etc. fields empty for all ! other overloaded functions with the same name. Parameters ! FileName - Description for this parameter ! Form - Description for this parameter ! See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslator.Translate@TCustomForm Summary ! Write here a summary (1 line) Description ! Write here a description ! This is an overloaded function/procedure, if possible you may combine the description ! of all these functions into 1 general description. If you do so, combine all "Parameter" ! lists into 1 list, and leave the "Summary", "Description" etc. fields empty for all ! other overloaded functions with the same name. Parameters ! Form - Description for this parameter ! See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslator.Translate@TStream ! Summary ! Write here a summary (1 line) Description ! Write here a description ! This is an overloaded function/procedure, if possible you may combine the description ! of all these functions into 1 general description. If you do so, combine all "Parameter" ! lists into 1 list, and leave the "Summary", "Description" etc. fields empty for all ! other overloaded functions with the same name. Parameters ! Stream - Description for this parameter ! See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslator.TranslateScreen@string Summary ! Write here a summary (1 line) Description ! Write here a description ! This is an overloaded function/procedure, if possible you may combine the description ! of all these functions into 1 general description. If you do so, combine all "Parameter" ! lists into 1 list, and leave the "Summary", "Description" etc. fields empty for all ! other overloaded functions with the same name. Parameters ! FileName - Description for this parameter ! See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslator.TranslateScreen@TStream Summary ! Write here a summary (1 line) Description ! Write here a description ! This is an overloaded function/procedure, if possible you may combine the description ! of all these functions into 1 general description. If you do so, combine all "Parameter" ! lists into 1 list, and leave the "Summary", "Description" etc. fields empty for all ! other overloaded functions with the same name. Parameters ! Stream - Description for this parameter ! See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslatorStrings --- 15,161 ---- FLAG=Component Summary ! \Component to translate an application, form or component. Description ! TJvTranslator is a non-visual component that can be used to automatically change the properties of forms and components. The ! forms and components to change and what value to change their properties to can be read from a string, a stream or a file. ! ! You can also use this component to read the components and their propeties and create an XML string from it. You can then ! use the generated XML to create a template used in translation. ---------------------------------------------------------------------------------------------------- ! @@TJvTranslator.ComponentToXML@TComponent@boolean Summary ! \Converts the properties of a TComponent to an XML string. Description ! Use ComponentToXML to convert th ename and published properties of a TComponent instance into an correctly ! formatted XML string compatible with the format used by JvTranslator. You can create a translation ! template file for your application by calling ComponentToXML for each ! form, combine the returned strings, wrap the string in the <Translation> root node and finally save the string to a file. ! Note that ComponentToXML lists all published properties of a component and you might have to clean the returned XML from ! properties you don't need to translate. ! Parameters ! AComponent - The component to create the XL fragment for. If AComponent is found in the skip list, its properties will ! not be listed. ! Recurse - Set this parameter to true to recurse the Components array of AComponent and create the XML for owned ! components as well. If AComponent is in th eskip list and Recurse is true, the owned components of AComponent ! will still be checked and its properties added to the XML string. Return value ! An XML string than can be used in calls to TJvTranslator.Translate or as a building block for a XML translation ! template file. Note that the returned XML string does not include the root node (<Translation>) ! necessary when reading translations from a file. You must add this manually yourself (or in code). See Also ! SkipClass, InSkipList ---------------------------------------------------------------------------------------------------- @@TJvTranslator.InSkipList@TClass Summary ! \Checks if a specific class is skipped when creating XML with ComponentToXML Description ! InSkipList returns true if the specified class has been added to the skip list by a call to SkipClass. ! If a class is in the skip list, it's properties will not be included in the XML string. Parameters ! AClass - The class to check Return value ! True if AClass is in the skip list, false if it is not. See Also ! SkipClass, ComponentToXML ---------------------------------------------------------------------------------------------------- @@TJvTranslator.SkipClass Summary ! \Adds a class to the internal skip list. Description ! Call SkipClass with a class name to add the class to the skip list. The skip list is used by ! ComponentToXML to determine whether the properties of a class should be added to the returned XML string. Note that ! even if a class is in the skip list, the Components array of the skipped class will still be iterated and checked if ! the Recurse parameter to ComponentToXML is true. Parameters ! AClass - The class to skip. Calling SkipClass with the same class multiple times, does nothing. See Also ! ComponentToXML, InSkipList ---------------------------------------------------------------------------------------------------- @@TJvTranslator.Translate@string Summary ! \Translates the entire application. Description ! Translates all forms in the current application using the XML in FileName. Only instanced forms and their components are translated Parameters ! FileName - The name of the file containing the translation ---------------------------------------------------------------------------------------------------- @@TJvTranslator.Translate@string@string Summary ! \Translates a string using the currently loaded XML. Description ! Searches the currently loaded XML for a node matching the names as defined by Category and Item and returns the found value. ! Example: ! If Category = "Variables" and Item = "Item", the XML would have to llok like the follwing for this method to find a match: ! <CODE> ! <Translation> ! ... ! <Variables> ! <Item>XXXXX</Item> ! </Variables> ! ... ! </Translation> ! </CODE> ! ! This would return the string "XXX". Alternatively, the XML could look like this: ! <CODE> ! <Translation> ! ... ! <Variables> ! <Item Value="YYYY" /> ! </Variables> ! ... ! </Translation> ! </CODE> ! This would return the string "YYY". if nore than one node has the same name, the first one found is the one used. ! Parameters ! Category - The name of the Category of the translation to use. The value of this parameter is checked against the names of ! the direct sub nodes of the root node in the XML ! Item - The name of the Item of the translation to use. The value of this parameter is checked agains the names of the subnodes Return value ! Returns the value of the Item node or, if not found, the value of a property of Item named "Value" or an empty string if the node was not found. ---------------------------------------------------------------------------------------------------- @@TJvTranslator.Translate@string@TCustomForm Summary ! \Translates a form. Description ! Translates a form and all contained components on the form using th translation laoded from filename. ! If the file cannot be found, this function raises an exception. Parameters ! FileName - The name of the file containing the translation ! Form - The form to translate ---------------------------------------------------------------------------------------------------- @@TJvTranslator.Translate@TCustomForm Summary ! \Translates a form. Description ! Translates a form and all contained components on the form using the currently loaded XML. The XML can be loaded with ! any of the Translate functions that contains a string, a filename or a stream. Parameters ! Form - The form to translate ---------------------------------------------------------------------------------------------------- @@TJvTranslator.Translate@TStream ! \Translates the entire application. Description ! Translates all forms in the current application using the XML in the stream. Only instanced forms and their components are translated Parameters ! Stream - The stream to read the XML from. The reading starts at the current position in the stream ---------------------------------------------------------------------------------------------------- @@TJvTranslator.TranslateScreen@string Summary ! \Translates all forms on the screen. Description ! Translates all forms maintained by the global Screen object. Only instanced forms and their components are translated Parameters ! FileName - The name of the file containing the translation ---------------------------------------------------------------------------------------------------- @@TJvTranslator.TranslateScreen@TStream Summary ! \Translates all forms on the screen. Description ! Translates all forms maintained by the global Screen object. Only instanced forms and their components are translated Parameters ! Stream - The stream to read the XML from. The reading starts at the current position in the stream ---------------------------------------------------------------------------------------------------- @@TJvTranslatorStrings *************** *** 176,234 **** FLAG=Component Summary ! Write here a summary (1 line) Description ! Write here a description ---------------------------------------------------------------------------------------------------- @@TJvTranslatorStrings.Add Summary ! Write here a summary (1 line) Description ! Write here a description Parameters ! Name - Description for this parameter ! Value - Description for this parameter Return value ! Describe here what the function returns ! See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslatorStrings.Count Summary ! Write here a summary (1 line) Description ! Write here a description See Also - List here other properties, methods (comma seperated) - Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslatorStrings.IndexOf Summary ! Write here a summary (1 line) Description ! Write here a description Parameters ! Name - Description for this parameter Return value ! Describe here what the function returns See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslatorStrings.Strings Summary ! Write here a summary (1 line) Description ! Write here a description See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTranslatorStrings.Value Summary ! Write here a summary (1 line) Description ! Write here a description ! See Also ! List here other properties, methods (comma seperated) ! Remove the 'See Also' section if there are no references --- 165,244 ---- FLAG=Component Summary ! \TJvTranslatorStrings is used to store translatable strings that are not part of a form or component, like variables etc. Description ! To be able to translate string variables not part of a class, you can use the TJvTranslatorStrings component. ! Drop it on a form (one per application is enough) and, at run-time, add the strings you want to translate by using the ! Add method. Note that the strings you add must be declared as global variables somewhere in your project. ! ! Example: ! <CODE> ! var AString:string = 'This is a string'; ! ! ... ! // adding to list: ! JvTranslatorStrings.Add('AString',AString); ! ! // using: ! ShowMessage(AString); // this will show the translated value of AString if it was included in the translation data ! // loaded into a TJvTranslator instance ! ! </CODE> ! ---------------------------------------------------------------------------------------------------- @@TJvTranslatorStrings.Add Summary ! \Adds a new Name/Value pair to the translation list Description ! Use Add to add Name/Value pair of strings that you want to be able to translate. The Value must be available as a ! global variable somewhere in your project since TJvTranslatorStrings only stores a reference to it ! (that is how it can transalte it automatically). When you use the string, use the variable, so you get the translated ! value of the string. Parameters ! Name - The name of the string variable. This value must be unique within the application ! Value - The value of the string Return value ! The index into the list where the Name/Value pair was saved ---------------------------------------------------------------------------------------------------- @@TJvTranslatorStrings.Count Summary ! \Returns the number of items in the list. Description ! Count contains the number of items in the Strings and Value array. Since Strings and Value are indexed starting with 0, ! the value of Count is always one greater than the index of the last member of Strings and Value. See Also ---------------------------------------------------------------------------------------------------- @@TJvTranslatorStrings.IndexOf Summary ! \Returns the position of a string in the list. Description ! Call IndexOf to obtain the position of the first occurrence of the string Name, ! or of a string that differs from Name only by case. IndexOf returns the 0-based index of the string. ! Thus, if Name matches the first string in the list, IndexOf returns 0, if Name is the second string, ! IndexOf returns 1, and so on. If the string is not in the list, IndexOf returns -1. Parameters ! Name - The string to search for Return value ! The 0-based index of the found string or -1 if not found See Also ! Strings, Value ---------------------------------------------------------------------------------------------------- @@TJvTranslatorStrings.Strings Summary ! \Lists the names, referenced by a 0-based index. Description ! Use Strings to read or modify the string at a particular position. ! Index gives the position of the string, where 0 is the position of the first string, 1 is the position of the ! second string, and so on. To locate a particular string in the list, call the IndexOf method. ! ! Note that this property does not work like you might expect. Specifically, when reading, the returned value is ! the <i>Name</i> part of the string, but when writing the value is written to the <i>Value</i> part of the string. To read the value, use Value instead. See Also ! Add, IndexOf, Value ---------------------------------------------------------------------------------------------------- @@TJvTranslatorStrings.Value Summary ! \Lists the values, referenced by a 0-based index. Description ! Use Strings to read the value of a string at a particular position. ! Index gives the position of the string, where 0 is the position of the first string, 1 is the position of the ! second string, and so on. |