Skip to content

CustomerCenter shows incorrect duration format in Japanese #2259

@chibatching

Description

@chibatching

Describe the bug

  1. Environment
    1. Platform: Android
    2. SDK version: 8.14.2
    3. OS version: Android 15
    4. Android Studio version: Meerkat
    5. All devices with Japanese language setting
  2. No logs
  3. Steps to reproduce, with a description of expected vs. actual behavior
    1. Subscribe to a 1-month cycle subscription.
    2. Open CustomerCenter on a device set to Japanese.
    3. The billing cycle row displays か月, but 1か月 is expected.
  1. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)
    The Period.localized function removes 1 from the localized period text. For example, 1 month is transformed into month:
    private fun Period.localized(
    locale: Locale,
    width: MeasureFormat.FormatWidth,
    ): String {
    var formattedPeriod = localizedPeriod(locale, width)
    if (value == 1 && formattedPeriod.startsWith("1")) {
    formattedPeriod = formattedPeriod.substring(startIndex = 1).trim()
    }
    return formattedPeriod
    }

This works well in English but not in all languages. At least in Japanese, か月 is a duration expression for "month," but it requires a number, even if it is 1.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions