prefer-providing-intl-description
Warns when the Intl.message()
, Intl.plural()
, Intl.gender()
or Intl.select()
methods are invoked without a description.
To make the translator's job easier, provide a description of the message usage.
Example
❌ Bad:
import 'package:intl/intl.dart';
class SomeClassI18n {
// LINT: Missing the description for the translated message. Try providing it.
static final String message = Intl.message(
'message',
name: 'SomeClassI18n_message',
desc: '',
);
// LINT: Missing the description for the translated message. Try providing it.
static String plural = Intl.plural(
1,
one: 'one',
other: 'other',
name: 'SomeClassI18n_plural',
);
// LINT: Missing the description for the translated message. Try providing it.
static String gender = Intl.gender(
'other',
female: 'female',
male: 'male',
other: 'other',
name: 'SomeClassI18n_gender',
desc: '',
);
// LINT: Missing the description for the translated message. Try providing it.
static String select = Intl.select(
true,
{true: 'true', false: 'false'},
name: 'SomeClassI18n_select',
);
}
✅ Good:
import 'package:intl/intl.dart';
class SomeClassI18n {
static final String message = Intl.message(
'message',
name: 'SomeClassI18n_message',
desc: 'Message description',
);
static String plural = Intl.plural(
1,
one: 'one',
other: 'other',
name: 'SomeClassI18n_plural',
desc: 'Plural description',
);
static String gender = Intl.gender(
'other',
female: 'female',
male: 'male',
other: 'other',
name: 'SomeClassI18n_gender',
desc: 'Gender description',
);
static String select = Intl.select(
true,
{true: 'true', false: 'false'},
name: 'SomeClassI18n_select',
desc: 'Select description',
);
}