Difference between revisions of "API Language.Translate"

From Flowcode Help
Jump to navigationJump to search
(XML Import to change Variable types into Variable Types)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<sidebar>API contents</sidebar>
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Takes English text and optional hint and converts to the current language
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Translate'''
 +
|-
 +
| colspan="2" | Takes English text and optional hint and converts to the current language&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" | Text
 +
|-
 +
| colspan="2" | The English text to translate to the Flowcode language&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" | Hint
 +
|-
 +
| colspan="2" | A contextual single word hint to help the translation&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
<div style="width:25%; float:right" class="toc">
 
====Class hierarchy====
 
[[API Language|Language]]
 
:[[API Language|Translate]]
 
</div>
 
__TOC__
 
  
==Parameters==
+
==Detailed description==
[[Variable Types|STRING]] ''Text''
+
This takes the '''English''' string ''Text'' and attempts a conversion to an equivalent phrase in the users native language. The dictionary searches are exact (minus punctuation and case) - there is no predictive or fuzzy logic applied in order to translate. This means results stay fast and accurate.
:The English text to translate to the Flowcode language
 
  
[[Variable Types|STRING]] ''Hint''
 
:A contextual single word hint to help the translation
 
:''The default value for this parameter is: '''''""'''
 
  
 +
If the English phrase is not found in the dictionary then it will be returned as the result.
  
==Return value==
 
[[Variable Types|STRING]]
 
  
''<span style="color:red;">No additional information</span>''
+
The ''Hint'' is used in cases where an English phrase is ambiguous - "Bark" for example may refer to bark of a tree or the sound a dog makes. In this case supplying the ''Hint'' as "dog" or "tree" helps resolve ambiguity. Hints are not case sensitive and by convention are always one word. Not all phrases have a hint 9most will not) as these are only required where a phrase can have different English meanings.
  
  
==Detailed description==
+
By convention Flowcode uses Americanised English, so "color" not "colour".
''<span style="color:red;">No additional information</span>''
 
  
  
Line 32: Line 39:
 
* Declare a variable 'result' of type STRING
 
* Declare a variable 'result' of type STRING
 
* Add to a calculation icon: <pre class="brush:[cpp]">result = ::Language.Translate("text", "hint")</pre>
 
* Add to a calculation icon: <pre class="brush:[cpp]">result = ::Language.Translate("text", "hint")</pre>
 
''<span style="color:red;">No additional information</span>''
 

Latest revision as of 11:55, 16 January 2023

Fc9-comp-macro.png Translate
Takes English text and optional hint and converts to the current language 
Fc9-string-icon.png - STRING Text
The English text to translate to the Flowcode language 
Fc9-string-icon.png - STRING Hint
A contextual single word hint to help the translation 
Fc9-string-icon.png - STRING Return


Detailed description

This takes the English string Text and attempts a conversion to an equivalent phrase in the users native language. The dictionary searches are exact (minus punctuation and case) - there is no predictive or fuzzy logic applied in order to translate. This means results stay fast and accurate.


If the English phrase is not found in the dictionary then it will be returned as the result.


The Hint is used in cases where an English phrase is ambiguous - "Bark" for example may refer to bark of a tree or the sound a dog makes. In this case supplying the Hint as "dog" or "tree" helps resolve ambiguity. Hints are not case sensitive and by convention are always one word. Not all phrases have a hint 9most will not) as these are only required where a phrase can have different English meanings.


By convention Flowcode uses Americanised English, so "color" not "colour".


Examples

Calling in a calculation

  • Declare a variable 'result' of type STRING
  • Add to a calculation icon:
    result = ::Language.Translate("text", "hint")