Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List TODO comments for each language #34

Open
aiji42 opened this issue Dec 13, 2022 · 3 comments
Open

List TODO comments for each language #34

aiji42 opened this issue Dec 13, 2022 · 3 comments

Comments

@aiji42
Copy link
Owner

aiji42 commented Dec 13, 2022

Some languages have data that is not fully translated in some parts, which is marked with a TODO comment.
By making a list and making it easy to check, we make it possible for the language user to easily notice and contribute to the translation.

@lSelectral
Copy link

lSelectral commented Feb 22, 2023

@aiji42 Hello,

Would it be useful to create issues for each language that isn't complete with a template like below?


ZOD-I18N

English

  • Errors
    • Argument and Type Errors
    • Invalid Strings
    • Too Small
      • Array
      • String
      • Number
      • Set
      • Date
    • Too Big
      • Array
      • String
      • Number
      • Set
      • Date
  • Validations
  • Types

@aiji42
Copy link
Owner Author

aiji42 commented Feb 23, 2023

It may indeed be useful.
However, there are some situations that cannot be expressed by true/false. For example, when an update is made that allows for a detailed processing message by giving an option value, and that has not yet been addressed.

It would be nice to have this kind of expression, but it would probably be difficult on the markdown. Perhaps a dedicated documentation site is needed.

[ ]
[-] (with memo)
[x]

@lSelectral
Copy link

lSelectral commented Feb 23, 2023

@aiji42 Hello,
Come to think again, you are right. Managing by readme is really tiresome and doomed to be obsolete quickly.

I found a way to compare all files with english translation and find missing. Then we can write this missing fields to readme, documentation or where ever you want.

Result looks like this: ( This is real comparision between ENGLISH and SPANISH translation )

COMPARE RESULT OBJECT
{
    "errors": {
        "too_small": {
            "array": {
                "exact": {
                    "before": "Array must contain exactly {{minimum}} element(s)"
                }
            },
            "string": {
                "exact": {
                    "before": "String must contain exactly {{minimum}} character(s)"
                }
            },
            "number": {
                "exact": {
                    "before": "Number must be exactly {{minimum}}"
                }
            },
            "date": {
                "exact": {
                    "before": "Date must be exactly {{- minimum, datetime}}"
                }
            }
        },
        "too_big": {
            "array": {
                "exact": {
                    "before": "Array must contain exactly {{maximum}} element(s)"
                }
            },
            "string": {
                "exact": {
                    "before": "String must contain exactly {{maximum}} character(s)"
                }
            },
            "number": {
                "exact": {
                    "before": "Number must be exactly {{maximum}}"
                }
            },
            "date": {
                "exact": {
                    "before": "Date must be exactly {{- maximum, datetime}}"
                }
            }
        }
    }
}

CODE TO COMPARE
function compareObjects(obj1: any, obj2: any): any {
const diff: any = {};

for (const key in obj1) {
  if (Object.prototype.hasOwnProperty.call(obj1, key)) {
    if (!(key in obj2)) {
      diff[key] = { before: obj1[key], after: undefined };
    } else if (obj1[key] instanceof Object) {
      const nestedDiff = compareObjects(obj1[key], obj2[key]);
      if (Object.keys(nestedDiff).length > 0) {
        diff[key] = nestedDiff;
      }
    }
  }
}

return diff;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants