boxblinkracer / phpunuhi

PHPUnuhi - The easy composable framework to validate and manage translations
MIT License
72 stars 5 forks source link

Duplicate Content check can cause problems in specific languages #36

Closed matthiashamacher closed 5 months ago

matthiashamacher commented 10 months ago

We currently have the problem that we have a translation for Country, like USA or Germany, and Country, the style or synonyme for Countryside. This causes problems with the duplicate check as it fails only in the english translations not i.e. the german as we have Land and Country there. As they mean something different by context and are spelled differently in german we cannot aggregate them to one key. This is probably not the only word and langauge where this can cause problems.

For now, which fixes this problem in our case, the filter logic for the key would be suffice so I've implemented it for yaml: #35

But in any other case this maybe would not be enough so I think we need to think about another possibility to fix this issue. My first idea would be to have a whitelist option for the duplicate content rule. Probably you also need to make it language specific as you want Country twice in english but only once in german.

Would that be a viable solution or are there any better ones? I'm happy to implement it but wanted your feedback first.

boxblinkracer commented 9 months ago

Hi

i think i dont really get it duplicate check is only for the content, if Germany and Deutschland are different as values then its not duplicate?

do you have an example?

thank you

matthiashamacher commented 9 months ago

Following Example Translation Files: admin.en.yaml

app:
    title:
        country: Country
    style:
        country: Country

admin.de.yaml

app:
    title:
        country: Land
    style:
        country: Country

This would result in a duplicate content for the admin.en.yaml but not admin.de.yaml. In other cases we would consolidate both translations into one so we have no duplicates. In this case this is not possible as in german those translations are written different and cannot be consolidated into one translation.

Therefore my proposal was to have a file/language specific filter option for that rule so we can exclude country for the english translation file.

boxblinkracer commented 5 months ago

Hi

implemented in the latest dev-master :)

thanks for this great idea

boxblinkracer commented 5 months ago

released in 1.17.0