Skip to content

I18N Rules (BI18N001–BI18N003)

Rules that detect internationalization issues in Gherkin feature files, such as hardcoded locale-specific text or non-ASCII characters.

Default severity: WARNING


BI18N001: hardcoded-date-format

Detects steps that contain hardcoded date or time formats (e.g., 12/31/2024, 2024-12-31, 31-12-2024). Date formats are locale-specific and may cause test failures in different regions or time zones.

The rule matches common date patterns:

  • MM/DD/YYYY and M/D/YYYY
  • YYYY-MM-DD and YYYY/MM/DD
  • DD-MM-YYYY and DD/MM/YYYY
  • HH:MM:SS time formats

Tags: i18n, date, locale

Since: 2.4.0

Example

Before → After

Before:

Feature: Booking

  Scenario: Book on a date
    Given the booking date is "12/31/2024"

After:

Feature: Booking

  Scenario: Book on a date
    Given the booking date is "<booking_date>"

How it works

  1. Iterates over all scenarios and their steps.
  2. Searches each step text for common date and time format patterns using a regex.
  3. Reports a diagnostic suggesting a placeholder or parameterized value.

Configuration

This rule has no configurable parameters.


BI18N002: hardcoded-currency

Detects steps that contain hardcoded currency symbols like $, , £, ¥, or currency codes like USD, EUR, GBP. Currency symbols are locale-specific and may not be appropriate for all regions.

Tags: i18n, currency, locale

Since: 2.4.0

Example

Before → After

Before:

Feature: Payment

  Scenario: Pay amount
    Given the total is "$99.99"

After:

Feature: Payment

  Scenario: Pay amount
    Given the total is "<amount>"

How it works

  1. Iterates over all scenarios and their steps.
  2. Searches each step text for currency symbols ($, , £, ¥) and currency codes (USD, EUR, GBP, JPY, etc.) using a regex.
  3. Reports a diagnostic suggesting a placeholder or parameterized value.

Configuration

This rule has no configurable parameters.


BI18N003: non-ascii-step-text

Detects steps that contain non-ASCII characters (e.g., accented letters, CJK characters, emoji). While UTF-8 is widely supported, non-ASCII characters can cause encoding issues in some test runners, CI environments, or when sharing files across platforms.

Tags: i18n, encoding, ascii

Since: 2.4.0

Default severity: INFO

Example

Before → After

Before:

Feature: Café menu

  Scenario: Order coffee
    Given the customer selects "café au lait"

After:

Feature: Cafe menu

  Scenario: Order coffee
    Given the customer selects "cafe au lait"

How it works

  1. Iterates over all scenarios and their steps.
  2. Searches each step text for characters outside the ASCII range (codepoints > 127) using a regex.
  3. Reports an INFO diagnostic suggesting to replace non-ASCII characters with ASCII equivalents or ensure UTF-8 encoding.

Configuration

This rule has no configurable parameters.