Boost User Experience: Default To English In Things CLI

by SLV Team 56 views
Enhance Things CLI: Default to English for a Better User Experience

Hey guys, let's talk about improving the Things CLI experience! This is a simple but impactful change. The current setup uses German as a fallback locale when it can't automatically detect your language settings. This can be confusing for a lot of users, especially if they are not German speakers. The proposal is to switch the default fallback language to English. Let's dive deeper into why this is a good idea, the changes involved, and the potential impact it'll have.

The Problem: Why German Isn't the Best Default

So, here's the deal: When the Things CLI can't figure out your language, it defaults to German. This is not ideal, and here's why:

  • Universality of English: English is the global language of technology and communication. A vast majority of users worldwide have at least some understanding of English.
  • Technical Tools Tradition: Most technical tools and software applications default to English, creating a more consistent and familiar experience for users.
  • Confusion for Non-German Speakers: If you're using Things 3 in any language other than German, seeing German error messages or default text can be really baffling. It can create a frustrating user experience.
  • Arbitrary Choice: The selection of German as the default was pretty much down to the original context of the development. It wasn't based on any particular user need or preference.

Current Implementation: Where the Fallback Lives

The current implementation is straightforward. The fallback to German is hardcoded in the things_jxa.py file. Specifically, lines 104-105 are where the magic happens (or, in this case, the German happens).

# things_jxa.py:104-105
console.print(f"[yellow]Warning: Could not auto-detect locale, using German. Error: {e}[/yellow]")
return LOCALE_MAPPINGS["de"]

As you can see, if the automatic language detection fails, the code directly specifies the German locale "de".

Proposed Solution: English as the New Default

The most straightforward solution is to change the fallback language to English. This is the core of the proposed changes. Here's how it would look in the code:

console.print(f"[yellow]Warning: Could not auto-detect locale, using English fallback.[/yellow]")
return LOCALE_MAPPINGS["en"]

Rationale Behind the Change

Switching to English as the default fallback makes a lot of sense, because:

  • Language of Software: English is the lingua franca of software development. Most developers and users are more familiar with English.
  • Things 3 Origin: Things 3, the app the CLI interacts with, is an English-language app. It's logical to align the CLI's default with the app's primary language.
  • Wider User Base: More users are likely to have English as a primary or secondary language compared to German. It ensures fewer users will be caught off guard by an unfamiliar language.
  • Industry Standard: This approach aligns with industry standards, where most tools default to English. It creates a more consistent experience.

Alternative: Configuration Through Environment Variable

Here’s an even more flexible solution. Adding an environment variable for the fallback locale is a great alternative. This approach offers users greater control over the CLI's behavior.

DEFAULT_LOCALE = os.getenv("THINGS_CLI_FALLBACK_LOCALE", "en")

# In detect_list_names():
console.print(f"[yellow]Warning: Could not auto-detect locale, using {DEFAULT_LOCALE} fallback.[/yellow]")
return LOCALE_MAPPINGS.get(DEFAULT_LOCALE, LOCALE_MAPPINGS["en"])

With this method, the CLI will look for an environment variable called THINGS_CLI_FALLBACK_LOCALE. If the user sets this variable (e.g., to "de"), the CLI will use German as the fallback. If the variable is not set, it defaults to English.

Impact: What Changes Will It Bring?

Let’s assess what kind of impact this change will bring.

  • Priority: Low, because it's a minor change with a limited impact on most users.

  • Affected Code: Primarily things_jxa.py (specifically lines 104-105).

  • Breaking Changes:

    • Users relying on the current German fallback will now see English. This is a minor disruption, as most users won't encounter the fallback at all (because auto-detection usually works).
    • However, it's easily mitigated! Users who require German can specify the language using the --locale de parameter when running the CLI.
  • Migration Path:

    • We’ll include a note in the release notes to document this change.
    • Recommend users of German Things use the --locale de explicitly if they wish to keep German.
    • Alternatively, provide the option of setting the THINGS_CLI_FALLBACK_LOCALE=de environment variable (if the configurable option is implemented).

Acceptance Criteria: What Needs to Happen

To consider this change complete, we need the following:

  • [x] Fallback locale changed to English in the primary implementation.
  • [x] The error messages are updated to reflect the new English fallback.
  • [x] Documentation is updated to explain the change and how to specify the locale.
  • [x] Release notes include a mention of the change, so users are informed.
  • [x] Tests updated to verify the new fallback behavior is functioning correctly.

Discussion: Is This a Breaking Change?

Technically, yes, it’s a breaking change, but its impact is minimal. The impact is minimal because:

  1. Auto-detection Works: For the majority of users, the auto-detection feature works flawlessly. These users won’t ever see the fallback.
  2. Explicit Setting: Users can use the --locale de if they require German.
  3. Fallback Trigger: The fallback is only activated if Things 3 is unavailable or JXA (JavaScript for Automation) fails, making it a rare occurrence.

Additional Context: Where This Came From

This proposal originated during the post-implementation review of a previous update, specifically the multi-locale support feature (#1). The goal is to provide a user-friendly and consistent experience.

Labels: enhancement, breaking-change