Skip to main content

WOVN Ignore Feature

The WOVN Flutter SDK provides flexible options to exclude specific text from translation. This is useful for:

  • Protecting sensitive information (e.g., passwords, API keys, personal data)
  • Excluding technical identifiers (e.g., error codes, IDs)
  • Maintaining original language in specific UI elements

Method 1: Using the isIgnored Property

Add isIgnored: true to any WovnText or WovnRichText widget to prevent translation.

Basic Text Example

import 'package:wovn_flutter/wovn_flutter.dart';

typedef Text = WovnText;

Text(
'This text will not be translated',
isIgnored: true,
style: TextStyle(color: Colors.red),
)

Text.rich Example

Text.rich(
TextSpan(
text: 'This Text.rich ',
children: [
TextSpan(
text: 'will be ignored by WOVN. ',
style: TextStyle(fontWeight: FontWeight.bold),
),
TextSpan(
text: 'All content remains in the original language.',
style: TextStyle(fontStyle: FontStyle.italic),
),
],
),
isIgnored: true,
)

RichText Example

import 'package:wovn_flutter/wovn_flutter.dart';

typedef RichText = WovnRichText;

RichText(
text: TextSpan(
text: 'This RichText ',
style: TextStyle(color: Colors.black),
children: [
TextSpan(
text: 'will not be translated ',
style: TextStyle(fontWeight: FontWeight.bold),
),
TextSpan(
text: 'and stays in the original language.',
style: TextStyle(fontStyle: FontStyle.italic),
),
],
),
isIgnored: true,
)

Method 2: Using Key-Based Ignore

Any widget with a key containing the string "WovnIgnore" (case-sensitive) will be automatically excluded from translation.

Key-Based Text Example

Text(
'This text is ignored by its key',
key: Key('WovnIgnore_UserPassword'),
style: TextStyle(color: Colors.red),
)

Key-Based Text.rich Example

Text.rich(
TextSpan(
text: 'This content ',
children: [
TextSpan(
text: 'is ignored because of the key.',
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
key: Key('WovnIgnore_SensitiveData'),
)

Key-Based RichText Example

RichText(
text: TextSpan(
text: 'API Key: ',
children: [
TextSpan(
text: 'sk_live_1234567890abcdef',
style: TextStyle(fontFamily: 'monospace'),
),
],
),
key: Key('WovnIgnore_ApiKey_Display'),
)

Key Naming Conventions

The key must contain the string "WovnIgnore" (case-sensitive). Common patterns include:

  • Key('WovnIgnore_FieldName') - Standard format
  • Key('Wovnignore_Text_Widget1') - Alternative format
  • Key('UserForm_WovnIgnore_Password') - Embedded in longer key names
  • Key('WovnIgnore123') - With numeric suffix
Best Practice

Use descriptive key names that indicate why the text is ignored:

  • Key('WovnIgnore_Password_Field')
  • Key('WovnIgnore_API_Token')
  • Key('WovnIgnore_Brand_Logo_Text')

Comparison of Methods

MethodWhen to UseAdvantages
isIgnored: trueWhen you want explicit control at the widget levelClear intent in code, easy to spot, works with any widget structure
Key-basedWhen managing widgets programmatically or batch-ignoring similar elementsUseful for dynamic widgets, can be applied via key generation logic

Complete Example

import 'package:flutter/material.dart';
import 'package:wovn_flutter/wovn_flutter.dart';

typedef Text = WovnText;
typedef RichText = WovnRichText;

class UserProfileScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('User Profile')),
body: ListView(
children: [
// This text WILL be translated
Text('Welcome to your profile'),

Divider(),

// Method 1: Using isIgnored property
Text(
'User ID: ABC123XYZ',
isIgnored: true,
style: TextStyle(fontFamily: 'monospace'),
),

Divider(),

// Method 2: Using key-based ignore
Text(
'API Token: sk_live_xxxxxxxxxxxx',
key: Key('WovnIgnore_APIToken'),
style: TextStyle(fontFamily: 'monospace'),
),

Divider(),

// This text WILL be translated
Text('Account Settings'),

Divider(),

// Complex example: RichText with isIgnored
RichText(
text: TextSpan(
text: 'Password: ',
style: TextStyle(color: Colors.black),
children: [
TextSpan(
text: '••••••••',
style: TextStyle(fontSize: 20),
),
],
),
isIgnored: true,
),
],
),
);
}
}

Verifying Ignored Text

To verify that text is properly ignored:

  1. Enable Development Mode following the Development Mode guide
  2. Run your app with different language settings using:
    Wovn().changeLangUsingLocaleString('ja');
    Wovn().changeLangUsingLocaleString('en');
  3. Verify that ignored text remains in the original language while other text is translated
  4. Check the WOVN dashboard to confirm ignored text is not reported for translation