-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
Comments
@aiji42 Hello, Would it be useful to create issues for each language that isn't complete with a template like below? ZOD-I18NEnglish
|
It may indeed be useful. 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.
|
@aiji42 Hello, 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 COMPAREfunction 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;
} |
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.
The text was updated successfully, but these errors were encountered: