lingui / lingui/js-lingui

Place PO file relatively to the component file

Open
#2,025 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.9k
Forks
457
Avg merge
1d 23h
Merged PRs (30d)
16

Description

Is your feature request related to a problem? Please describe.
We are using AI to help with our codebase. We would auto-translate the PO files giving the AI also the original source file code to get as much context as possible. To effectively script it and keep it near the original context, we would like to place the PO file in the same directory as the original source code.

However, the {name} macro only gives the name of the original file...

Describe proposed solution
Offer some {dir} macro that will resolve into a folder of the source component

Describe alternatives you've considered
I was thinking about {path} macro as a full path to the component, but I think dir is more versatile, as it can be combined with {name} when needed and cover both (all) needs that I can imagine

Additional context
I could create a PR for this if approved. Otherwise I would like to learn if there are any serious reasons why you wouldn't like it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation and tests for the existing {name} macro, then trace how component source paths are resolved. Determine where a {dir} value would be specified and verified, and consider the expected behavior for source files in nested directories. Done means the macro resolves the source component's directory and its behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
internationalization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.