@@ -96,9 +96,10 @@ There are additional optional arguments to control translation, see
9696[ Text translation options] ( #text-translation-options ) below.
9797
9898` translateText() ` returns a ` TextResult ` , or a List of ` TextResult ` s
99- corresponding to your input text(s). ` TextResult ` has two accessors: ` getText() `
100- returns the translated text, and ` getDetectedSourceLanguage() ` returns the
101- detected source language code.
99+ corresponding to your input text(s). ` TextResult ` has the following accessors:
100+ - ` getText() ` returns the translated text,
101+ - ` getDetectedSourceLanguage() ` returns the detected source language code, and
102+ - ` getBilledCharacters() ` returns the number of characters billed for the text.
102103
103104``` java
104105class Example { // Continuing class Example from above
@@ -115,8 +116,10 @@ class Example { // Continuing class Example from above
115116 " en-GB" );
116117 System . out. println(results. get(0 ). getText()); // "How are you?"
117118 System . out. println(results. get(0 ). getDetectedSourceLanguage()); // "ja" the language code for Japanese
119+ System . out. println(results. get(0 ). getBilledCharacters()); // 7 - the number of characters in the source text "お元気ですか?"
118120 System . out. println(results. get(1 ). getText()); // "How are you?"
119121 System . out. println(results. get(1 ). getDetectedSourceLanguage()); // "es" the language code for Spanish
122+ System . out. println(results. get(1 ). getBilledCharacters()); // 12 - the number of characters in the source text "¿Cómo estás?"
120123
121124 // Translate into German with less and more Formality:
122125 System . out. println(translator. translateText(" How are you?" ,
0 commit comments