Difference: 0LASubrConvertTranslate (1 vs. 8)

Revision 82017-07-21 - JeanNeron

Line: 1 to 1
 
META TOPICPARENT name="APPXRuntimeSubroutineAPI"

.CONVERT TRANSLATE

Changed:
<
<
This subroutine converts a string from one language to another.
>
>
This subroutine converts a string from one language to another using the Application and System Dictionaries.
 

Usage:

Line: 23 to 23
 

Description:

Changed:
<
<
This subroutine converts a string from one language to another. The first five parameters are required, if any are missing the subroutine will CANCEL. The <trans_type>, <trans_app_id> and <trans_ver_id> parameters are optional. The translation uses the Dictionaries and Translations you have entered in the applications. Note that this routine should be invoked via SUBR with a RELATED or DETACHED invocation to ensure none of your fields are changed.
>
>
This subroutine converts a string from one language to another using the Application and System Dictionaries. The first five parameters are required, if any are missing the subroutine will CANCEL. The <trans_type>, <trans_app_id> and <trans_ver_id> parameters are optional. The translation uses the Dictionaries and Translations you have entered in the applications. Note that this routine should be invoked via SUBR with a RELATED or DETACHED invocation to ensure none of your fields are changed.
  <trans_text> returns the translated version of <source_text> (Required). This must be PASSed with Share "Y" to return the value.
Line: 47 to 47
 Token, Message and Field all follow the same rules for translating, i.e., they look for an exact match. If a match is not found, the text will be added to the Application Dictionary under the specified <trans_type>.
Changed:
<
<
<trans_app_id> is the Application Id whose dictionaries should be used for the translation (Optional). Defaults to the current application if not PASSed, or is blank.
>
>
<trans_app_id> is the Application Id whose dictionaries should be used for the translation (Possibly optional, see NOTE below). Defaults to the current application if not PASSed, or is blank.
 
Changed:
<
<
<trans_ver_id> is the Version Id whose dictionaries should be used for the translation (Optional). Defaults to the current version if not PASSed, or is blank.
>
>
<trans_ver_id> is the Version Id whose dictionaries should be used for the translation (Possibly optional, see NOTE below). Defaults to the current version if not PASSed, or is blank.
  <field_name> (Version 6.0 & higher only) is only required for Token translation types. It is the name of Token field you are translating. This is only available in Release 6.0 & higher. Prior to release 6.0 it is not possible to use this API to translate a Token field.
Changed:
<
<
If <trans_text> is too small to contain the translated text, --- .CONVERT TRANSLATE will contain 'Data was truncated'.
>
>
If <trans_text> is too small to contain the translated text, --- .CONVERT TRANSLATE will contain 'Data was truncated'.
  In all cases, if a translation is not found in the Application Dictionary, then the System Dictionary will be checked. If a translation is still not found, the text will be added to the Application Dictionary.

Note that this routine will return the <source_text> in the <trans_text> field if it is unable to translate <source_text>. In other words, you will always get something back from this routine, either the translated text, or as best a translation as possible. This is especially true if you are using the 'Text' <trans_type>. The translation routine always starts with the largest block of text and works it's way down until it has attempted everything. If it can find a match for the entire block of text, it will return that. If not, it will then look for matches of the paragraphs in the text. If it can find a match for the paragraph, it will return that. If not, it will look for matches at the sentence level. If it still cannot find a match, it will attempt to translate individual words, depending on the "Translate Words" setting on the <from_lang> file. Thus the result returned could be a mix of the original text and the portions that were able to be translated.

Added:
>
>
NOTE: If you invoke this via a SUBR command, the <trans_app_id> and <trans_ver_id> are NOT optional and must be PASSed for the correct dictionaries to be referenced. If you invoke this via a GOSUB, then <trans_app_id> and <trans_ver_id> are optional, however, --- TEMP 2k and some numeric PDFs (--- AI, etc) are not preserved by the subroutine and will change.
 

Comments:

Read what other users have said about this page or add your own comments.

Revision 72017-07-17 - JeanNeron

Line: 1 to 1
 
META TOPICPARENT name="APPXRuntimeSubroutineAPI"

.CONVERT TRANSLATE

Line: 14 to 14
  PASS <trans_type> FIELD SHARE? N PASS <trans_app_id> FIELD SHARE? N PASS <trans_ver_id> FIELD SHARE? N
Added:
>
>
PASS <field_name> FIELD SHARE? N
  SET --- .CONVERT TRANSLATE = SUBR --- .CONVERT TRANSLATE DETACHED END? N FAIL 0
    • Check for errors
Line: 50 to 51
  <trans_ver_id> is the Version Id whose dictionaries should be used for the translation (Optional). Defaults to the current version if not PASSed, or is blank.
Changed:
<
<
If <trans_text> is too small to contain the translated text, --- .CONVERT TRANSLATE will contain 'Data was truncated'.
>
>
<field_name> (Version 6.0 & higher only) is only required for Token translation types. It is the name of Token field you are translating. This is only available in Release 6.0 & higher. Prior to release 6.0 it is not possible to use this API to translate a Token field.

If <trans_text> is too small to contain the translated text, --- .CONVERT TRANSLATE will contain 'Data was truncated'.

  In all cases, if a translation is not found in the Application Dictionary, then the System Dictionary will be checked. If a translation is still not found, the text will be added to the Application Dictionary.

Revision 62017-07-13 - JeanNeron

Line: 1 to 1
 
META TOPICPARENT name="APPXRuntimeSubroutineAPI"

.CONVERT TRANSLATE

Line: 14 to 14
  PASS <trans_type> FIELD SHARE? N PASS <trans_app_id> FIELD SHARE? N PASS <trans_ver_id> FIELD SHARE? N
Added:
>
>
SET --- .CONVERT TRANSLATE =
  SUBR --- .CONVERT TRANSLATE DETACHED END? N FAIL 0
    • Check for errors IF --- .CONVERT TRANSLATE NE
Line: 36 to 37
 <trans_type> is the type of translation desired (Optional). Must be one of Field, Token, Clause, Message or Text. Defaults to Field if not PASSed, or is blank.

Added:
>
>
  • Text: One or more paragraphs. If a translation is not found for the entire block of text, it will be broken down into paragraphs, then sentences, then clauses, then words. In each case it will look for a translation of that paragraph, sentences or clause. The word level translation depends on the setting of the 'Translate Words' on the from Language record.
  • Clause: One or more words or phrases within a sentence. If a translation is not found, word level translation will be attempted, based on the 'Translate Words' on the from Language record.
  • Token: A TOKEN field or an ALPHA field with table values consisting of a word or a phrase which requires an exact match with an entry in the dictionary.
  • Message: Text from the system MESSAGE file requires an exact match with an entry in the dictionary.
  • Field: One or more phrases and words which requires an exact match with an entry in the dictionary.
 
Changed:
<
<
  • Text:One or more paragraphs
  • Clause:One or more words or phrases within a sentence
  • Token:A TOKEN field or an ALPHA field with table values consisting of a word or a phrase which requires an exact match with a Token entry in the dictionary.
  • Message:Text from the system MESSAGE file requires an exact match with a Message entry in the dictionary.
  • Field:One or more phrases and words.
>
>
Token, Message and Field all follow the same rules for translating, i.e., they look for an exact match. If a match is not found, the text will be added to the Application Dictionary under the specified <trans_type>.
 

<trans_app_id> is the Application Id whose dictionaries should be used for the translation (Optional). Defaults to the current application if not PASSed, or is blank.

Line: 50 to 52
  If <trans_text> is too small to contain the translated text, --- .CONVERT TRANSLATE will contain 'Data was truncated'.
Changed:
<
<
Note that this routine will return the <source_text> in the <trans_text> field if it is unable to translate <source_text>. In other word, you will always get something back from this routine, either the translated text, or as best a translation as possible. This is especially true if you are translating text which contain paragraphs or sentences. The translation routine always starts with the largest block of text and works it's way down until it has attempted everything. If it can find a match for the enter block of text, it will return that. If not, it will then look for matches of the paragraphs in the text. If it can find a match for the paragraph, it will return that. If not, it will look for matches at the sentence level. If it still cannot find a match, it will attempt to translate individual words, depending on the "Translate Words" setting on the <from_lang> file. Thus the result returned could be a mix of the original text and the portions that were able to be translated.
>
>
In all cases, if a translation is not found in the Application Dictionary, then the System Dictionary will be checked. If a translation is still not found, the text will be added to the Application Dictionary.

Note that this routine will return the <source_text> in the <trans_text> field if it is unable to translate <source_text>. In other words, you will always get something back from this routine, either the translated text, or as best a translation as possible. This is especially true if you are using the 'Text' <trans_type>. The translation routine always starts with the largest block of text and works it's way down until it has attempted everything. If it can find a match for the entire block of text, it will return that. If not, it will then look for matches of the paragraphs in the text. If it can find a match for the paragraph, it will return that. If not, it will look for matches at the sentence level. If it still cannot find a match, it will attempt to translate individual words, depending on the "Translate Words" setting on the <from_lang> file. Thus the result returned could be a mix of the original text and the portions that were able to be translated.

 

Comments:

Read what other users have said about this page or add your own comments.

It appears that the fields <trans_app_id> and <trans_ver_id> are indeed required, as it doesn't always seem to default properly to the currently running application/version.

Changed:
<
<
-- AlKalter - 2014-10-01
<--/commentPlugin-->
>
>
-- AlKalter - 2014-10-01
<--/commentPlugin-->
  -- JeanNeron - 2012-02-04 \ No newline at end of file

Revision 52015-02-23 - AlKalter

Line: 1 to 1
 
META TOPICPARENT name="APPXRuntimeSubroutineAPI"

.CONVERT TRANSLATE

Line: 38 to 37
 
Changed:
<
<
  • Text: One or more paragraphs
  • Clause: One or more words or phrases within a sentence
  • Token: A TOKEN field or an ALPHA field with table values consisting of a word or a phrase which requires an exact match with a Token entry in the dictionary.
  • Message: Text from the system MESSAGE file requires an exact match with a Message entry in the dictionary.
  • Field: One or more phrases and words.
>
>
  • Text:One or more paragraphs
  • Clause:One or more words or phrases within a sentence
  • Token:A TOKEN field or an ALPHA field with table values consisting of a word or a phrase which requires an exact match with a Token entry in the dictionary.
  • Message:Text from the system MESSAGE file requires an exact match with a Message entry in the dictionary.
  • Field:One or more phrases and words.
 

<trans_app_id> is the Application Id whose dictionaries should be used for the translation (Optional). Defaults to the current application if not PASSed, or is blank.

Line: 51 to 50
  If <trans_text> is too small to contain the translated text, --- .CONVERT TRANSLATE will contain 'Data was truncated'.
Changed:
<
<
Note that this routine will return the <source_text> in the <trans_text> field if it is unable to translate <source_text>. In other word, you will always get something back from this routine, either the translated text, or as best a translation as possible. This is especially true if you are translating text which contain paragraphs or sentences. If the translation routine always starts with the largest block of text and works it's way down until it has attempted everything. If it can find a match for the enter block of text, it will return that. If not, it will then look for matches of the paragraphs in the text. If it can find a match for the paragraph, it will return that. If not, it will look for matches at the sentence level. If it still cannot find a match, it will attempt to translate individual words, depending on the "Translate Words" setting on the <from_lang> file. Thus the result returned could be a mix of the original text and the portions that were able to be translated.
>
>
Note that this routine will return the <source_text> in the <trans_text> field if it is unable to translate <source_text>. In other word, you will always get something back from this routine, either the translated text, or as best a translation as possible. This is especially true if you are translating text which contain paragraphs or sentences. The translation routine always starts with the largest block of text and works it's way down until it has attempted everything. If it can find a match for the enter block of text, it will return that. If not, it will then look for matches of the paragraphs in the text. If it can find a match for the paragraph, it will return that. If not, it will look for matches at the sentence level. If it still cannot find a match, it will attempt to translate individual words, depending on the "Translate Words" setting on the <from_lang> file. Thus the result returned could be a mix of the original text and the portions that were able to be translated.
 

Comments:

Read what other users have said about this page or add your own comments.

Changed:
<
<

It appears that the fields <trans_app_id> and <trans_ver_id> are indeed required, as it doesn't always seem to default properly to the currently running application/version.

>
>
It appears that the fields <trans_app_id> and <trans_ver_id> are indeed required, as it doesn't always seem to default properly to the currently running application/version.
  -- AlKalter - 2014-10-01
<--/commentPlugin-->

Revision 42014-10-01 - AlKalter

Line: 1 to 1
 
META TOPICPARENT name="APPXRuntimeSubroutineAPI"

.CONVERT TRANSLATE

Line: 15 to 15
  PASS <trans_type> FIELD SHARE? N PASS <trans_app_id> FIELD SHARE? N PASS <trans_ver_id> FIELD SHARE? N
Changed:
<
<
SUBR --- .CONVERT TRANSLATED DETACHED END? N FAIL 0
>
>
SUBR --- .CONVERT TRANSLATE DETACHED END? N FAIL 0
 
    • Check for errors IF --- .CONVERT TRANSLATE NE
Line: 56 to 56
  Read what other users have said about this page or add your own comments.
Changed:
<
<

<--/commentPlugin-->
>
>

It appears that the fields <trans_app_id> and <trans_ver_id> are indeed required, as it doesn't always seem to default properly to the currently running application/version.

-- AlKalter - 2014-10-01

<--/commentPlugin-->
  -- JeanNeron - 2012-02-04 \ No newline at end of file

Revision 32012-02-10 - JeanNeron

Line: 1 to 1
 
META TOPICPARENT name="APPXRuntimeSubroutineAPI"

.CONVERT TRANSLATE

Line: 24 to 24
  This subroutine converts a string from one language to another. The first five parameters are required, if any are missing the subroutine will CANCEL. The <trans_type>, <trans_app_id> and <trans_ver_id> parameters are optional. The translation uses the Dictionaries and Translations you have entered in the applications. Note that this routine should be invoked via SUBR with a RELATED or DETACHED invocation to ensure none of your fields are changed.
Changed:
<
<
<trans_text> is the translated version of <source_text> (Required). This must be PASSed with Share "Y" to return the value.
>
>
<trans_text> returns the translated version of <source_text> (Required). This must be PASSed with Share "Y" to return the value.
 
Changed:
<
<
<trans_error> contains any addiitonal error messages from the translation (Required). This must be PASSed with Share "Y" to return the value.
>
>
<trans_error> returns any addiitonal error messages from the translation (Required). This must be PASSed with Share "Y" to return the value.
  <source_text> is the text you want translated (Required).
Line: 42 to 43
 
  • Token: A TOKEN field or an ALPHA field with table values consisting of a word or a phrase which requires an exact match with a Token entry in the dictionary.
  • Message: Text from the system MESSAGE file requires an exact match with a Message entry in the dictionary.
  • Field: One or more phrases and words.
Changed:
<
<
>
>
  <trans_app_id> is the Application Id whose dictionaries should be used for the translation (Optional). Defaults to the current application if not PASSed, or is blank.

Revision 22012-02-06 - JeanNeron

Line: 1 to 1
 
META TOPICPARENT name="APPXRuntimeSubroutineAPI"

.CONVERT TRANSLATE

Line: 35 to 36
  <trans_type> is the type of translation desired (Optional). Must be one of Field, Token, Clause, Message or Text. Defaults to Field if not PASSed, or is blank.
Added:
>
>
  • Text: One or more paragraphs
  • Clause: One or more words or phrases within a sentence
  • Token: A TOKEN field or an ALPHA field with table values consisting of a word or a phrase which requires an exact match with a Token entry in the dictionary.
  • Message: Text from the system MESSAGE file requires an exact match with a Message entry in the dictionary.
  • Field: One or more phrases and words.
 <trans_app_id> is the Application Id whose dictionaries should be used for the translation (Optional). Defaults to the current application if not PASSed, or is blank.

<trans_ver_id> is the Version Id whose dictionaries should be used for the translation (Optional). Defaults to the current version if not PASSed, or is blank.

Changed:
<
<
If <trans_text> is too small to contain the converted text, --- .CONVERT TRANSLATE will contain 'Data was truncated'.
>
>
If <trans_text> is too small to contain the translated text, --- .CONVERT TRANSLATE will contain 'Data was truncated'.

Note that this routine will return the <source_text> in the <trans_text> field if it is unable to translate <source_text>. In other word, you will always get something back from this routine, either the translated text, or as best a translation as possible. This is especially true if you are translating text which contain paragraphs or sentences. If the translation routine always starts with the largest block of text and works it's way down until it has attempted everything. If it can find a match for the enter block of text, it will return that. If not, it will then look for matches of the paragraphs in the text. If it can find a match for the paragraph, it will return that. If not, it will look for matches at the sentence level. If it still cannot find a match, it will attempt to translate individual words, depending on the "Translate Words" setting on the <from_lang> file. Thus the result returned could be a mix of the original text and the portions that were able to be translated.

 

Comments:

Read what other users have said about this page or add your own comments.

Revision 12012-02-04 - JeanNeron

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="APPXRuntimeSubroutineAPI"

.CONVERT TRANSLATE

This subroutine converts a string from one language to another.


Usage:

      PASS         <trans_text>               FIELD            SHARE? Y
      PASS         <trans_error>              FIELD            SHARE? Y
      PASS         <source_text>              FIELD            SHARE? N
      PASS         <from_lang>                FIELD            SHARE? N
      PASS         <to_lang>                  FIELD            SHARE? N
      PASS         <trans_type>               FIELD            SHARE? N
      PASS         <trans_app_id>             FIELD            SHARE? N
      PASS         <trans_ver_id>             FIELD            SHARE? N
      SUBR     --- .CONVERT TRANSLATED              DETACHED     END? N  FAIL 0
      *        Check for errors
      IF       --- .CONVERT TRANSLATE         NE

Description:

This subroutine converts a string from one language to another. The first five parameters are required, if any are missing the subroutine will CANCEL. The <trans_type>, <trans_app_id> and <trans_ver_id> parameters are optional. The translation uses the Dictionaries and Translations you have entered in the applications. Note that this routine should be invoked via SUBR with a RELATED or DETACHED invocation to ensure none of your fields are changed.

<trans_text> is the translated version of <source_text> (Required). This must be PASSed with Share "Y" to return the value.

<trans_error> contains any addiitonal error messages from the translation (Required). This must be PASSed with Share "Y" to return the value.

<source_text> is the text you want translated (Required).

<from_lang> is the language ID that identifies <source_text> (Required). This must be a valid language code as defined in Appx System Administration.

<to_lang> is the languge Id you want <source_text> translated to (Required). This must be a valid language code as defined in Appx System Administration.

<trans_type> is the type of translation desired (Optional). Must be one of Field, Token, Clause, Message or Text. Defaults to Field if not PASSed, or is blank.

<trans_app_id> is the Application Id whose dictionaries should be used for the translation (Optional). Defaults to the current application if not PASSed, or is blank.

<trans_ver_id> is the Version Id whose dictionaries should be used for the translation (Optional). Defaults to the current version if not PASSed, or is blank.

If <trans_text> is too small to contain the converted text, --- .CONVERT TRANSLATE will contain 'Data was truncated'.

Comments:

Read what other users have said about this page or add your own comments.


<--/commentPlugin-->

-- JeanNeron - 2012-02-04

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback