WOVN Ignore Feature
The Wovn.setWovnIgnore method allows you to exclude specific views from WOVN's translation and reporting functionalities. This is useful for protecting sensitive information or content that should not be translated.
Use Cases
- Sensitive Data: Exclude views containing personal information, passwords, or financial data
- Dynamic Content: Exclude views with user-generated content that shouldn't be reported
- Technical Content: Exclude code snippets, IDs, or technical identifiers that shouldn't be translated
Usage
To exclude a view from translation, call Wovn.setWovnIgnore with the view and true:
Wovn.setWovnIgnore(viewWithSensitiveData, true);
To re-enable translation for a previously ignored view:
Wovn.setWovnIgnore(viewWithSensitiveData, false);
Best Practices
When to Call
It is recommended to call Wovn.setWovnIgnore before the view is added to the screen, ideally in the onCreate method of the Activity. This ensures that the view is not translated when it is first displayed.
Example
public class ProfileActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
// Exclude sensitive user data from translation
TextView userEmailView = findViewById(R.id.user_email);
TextView userPhoneView = findViewById(R.id.user_phone);
TextView accountIdView = findViewById(R.id.account_id);
Wovn.setWovnIgnore(userEmailView, true);
Wovn.setWovnIgnore(userPhoneView, true);
Wovn.setWovnIgnore(accountIdView, true);
}
}
Hierarchy Behavior
When you set Wovn.setWovnIgnore on a parent view, all child views within that hierarchy will also be excluded from translation:
// Ignoring a parent ViewGroup will ignore all its children
LinearLayout sensitiveSection = findViewById(R.id.sensitive_section);
Wovn.setWovnIgnore(sensitiveSection, true);
// All TextViews, Buttons, etc. inside sensitiveSection will be ignored
Related
- Protect User Privacy - Overview of privacy protection features (see Getting Started section)
- Manual Translation - Manually translate specific views (see Features section)