Translate text

org.openintents.action.TRANSLATE

Use some translation engine to translate a text and return the result.

Use

public void startTranslateText(String text, String from, String to) {
    Intent intent = new Intent("org.openintents.action.TRANSLATE"); 
    intent.putExtra("android.intent.extra.TEXT", text); // String
    intent.putExtra("org.openintents.extra.FROM_LANGUAGE", from); // String
    intent.putExtra("org.openintents.extra.TO_LANGUAGE", to); // String
    if (intent.resolveActivity(getPackageManager()) != null) { 
      startActivityForResult(intent, REQUEST_CODE);
    }
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) { 
      String translatedText = data.getStringExtra(android.intent.extra.TEXT);
      // handle result
    }
}

Example intent filter

<activity ...>
    <intent-filter>
        <action android:name="org.openintents.action.TRANSLATE" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>
            

Apps Providing an Implementation

Search on Github

Search on Google Play, AppBrain, Amazon App store or similar (not yet available - please make this happen!)

For Specification Writers

Edit on Github