Skip to content

Remove pathPrefix, use only the country object key? #392

Description

@viethung26

In app/utils/const.ts, each COUNTRIES entry is already keyed by its path prefix (e.g. /zh-hk), and pathPrefix is derived from that key in context.ts:136 and schema.server.ts:31. So the explicit pathPrefix field looks redundant.

The one exception: /de-eu sets pathPrefix: "/de-EU" (capitalized), but getLocaleFromRequest lowercases the path and overwrites it with the key anyway — so that value seems unused.

To check

  • Is the explicit pathPrefix field ever actually used, or always overwritten?
  • Does the /de-EU casing matter for any generated URL?
  • Can we drop pathPrefix and derive it from the key in one place?

Affected

const.ts, context.ts, schema.server.ts, link.tsx, use-prefix-path-with-locale.ts, types/others.ts

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions