aymericzip / aymericzip/intlayer

Using constants in translations

Open
#89 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
TypeScript
Stars
833
Forks
126
Avg merge
1d 3h
Merged PRs (30d)
7

Description

Just started integrating this into our project, and it's fitting much of our use criteria except one key issue around our company / brand name.

We've just had to reword the name of our company from "Company Name" to "Other Detail: Company Name" in our app because of reasons out of our control. This means we've had to change every area that had "Company Name" in.

What would be amazing would be some way to "refer back" to another translation's entry.

As in, in your app's dictionary ,

import { type DeclarationContent } from "intlayer"

const appContent = {
  key: "app",

  content: {
    brandName: "Other Detail: Company Name",
    brandNameShort: "Company Name",
  }
} satisfies DeclarationContent

export default appContent

And then, in another page/component, you can pull that in,

import { DeclarationContent } from "intlayer"

const overviewContent = {
  key: "overview",
  content: {
    header: "Do all this awesome stuff with %%{app.brandName}%%",
    subHeader: "With %%{app.brandNameShort}%%, you'll be even more awesomer!"
  }
} satisfies DeclarationContent

export default overviewContent

Make sense?

Also, just checking on the status of the online editor? I tried setting up there but ran into a number of hangs and errors, and can't create an organisation, or new project at all.

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

No files, tests, or entry points are named. Start by reviewing the translation/content reference examples in the issue and the existing handling of translation values; clarify the reference syntax and scope before implementation. Done means one translation can reuse another value reliably, with coverage for the shown brand-name cases and the online-editor concerns separated.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.