open-condo-software / condo

Open source condominium management platform
MIT License
64 stars 26 forks source link

Domain hardcode #4731

Open paulo-rossy opened 4 months ago

paulo-rossy commented 4 months ago

Hi. I'm trying to adopt your project to ES language.

At the moment your translations have a hardcoded doma.ai name.

Can you mode it to some config? or use something like {{ SITE_NAME }} or something similar for that?

At the moment I've created a custom translation loader function with replace logic. I've replace everything related to doma.ai. But it looks a little hacky.

sitozzz commented 4 months ago

Hi there, that's good suggestion. I suppose we'll do this in one of the upcoming releases

Hi. I'm trying to adopt your project to ES language.

At the moment your translations have a hardcoded doma.ai name.

Can you mode it to some config? or use something like {{ SITE_NAME }} or something similar for that?

At the moment I've created a custom translation loader function with replace logic. I've replace everything related to doma.ai. But it looks a little hacky.

Hi there! That's a good suggestion, so I think we'll do this in one of the upcoming releases

SavelevMatthew commented 4 months ago

Hi, please clarify, are we talking about translations? If yes, you can use a separate translation for the company name and use intl + values in the translation lines where it is present.

Something like this:

{
  "company.name": "My Cool Company",
  "company.shortName": "Company",
  "company.domain": "company.com",
  "some.translation.with.company": "Thanks for visiting {companyName}!"
}
const intl = useIntl()
const CompanyTitle = intl.formatMessage({ id: 'company.name' })
const MyMessage = intl.formatMessage({ id: 'some.translation.with.company' }, {
    companyName: CompanyTitle
})

https://formatjs.io/docs/react-intl/api/#formatmessage

paulo-rossy commented 4 months ago

Yes, I can create own translations. But I want to pull changes from your repo from time to time.

It's better to move company name and company url to ENV or config.

What do you think?