slash icon indicating copy to clipboard operation
slash copied to clipboard

docs(validators): apply i18n for global

Open okinawaa opened this issue 3 years ago β€’ 1 comments

Overview

I have translated the @toss/validators package to the i18n specification.

Question

Currently, the folder structure seems to be not clean because there are implementation functions, test codes, and document files in one source file.

image

It may be okay now, but I think the bigger the @toss/validators package gets, the more messy it gets.

Is there a reason why you designed it like this? Here's how I thought about it.

πŸ“¦src
 ┣ πŸ“‚validators
 ┃ β”— πŸ“œis-age.ts
 ┃ β”— πŸ“œis-email.ts
 ┣ πŸ“‚__tests__
 ┃ β”— πŸ“œis-age.spec.ts
 ┃ β”— πŸ“œis-email.spec.ts
 ┣ πŸ“‚docs
   β”— πŸ“œis-age.ko.md
   β”— πŸ“œis-age.en.md
   β”— πŸ“œis-email.ko.md
   β”— πŸ“œis-email.en.md

PR Checklist

  • [x] I read and included theses actions below
  1. I have read the Contributing Guide
  2. I have written documents and tests, if needed.

okinawaa avatar Oct 15 '22 08:10 okinawaa

Deploy Preview for slash-libraries ready!

Name Link
Latest commit 87c3a8ffeb52b4cf2e3f492cf1973a8c6e9eb844
Latest deploy log https://app.netlify.com/sites/slash-libraries/deploys/634bb81b53407a0008992fc8
Deploy Preview https://deploy-preview-56--slash-libraries.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Oct 15 '22 08:10 netlify[bot]

It was by intention that the source code, test code, and documentation are put in the same directory. I thought they will always be edited together, so putting them as near as possible would be a better choice. (If they are far apart, we may forget to edit some files. I wish all docs and test cases are up to date)

But I agree that it might look messy as more files are added. For that case, what about arranging files like this?

is-age/
  index.ts
  index.spec.ts
  index.en.md
  index.ko.md
is-birth-date-6/
  index.ts
  index.spec.ts
  index.en.md
  index.ko.md

raon0211 avatar Oct 16 '22 03:10 raon0211

It was by intention that the source code, test code, and documentation are put in the same directory. I thought they will always be edited together, so putting them as near as possible would be a better choice. (If they are far apart, we may forget to edit some files. I wish all docs and test cases are up to date)

But I agree that it might look messy as more files are added. For that case, what about arranging files like this?

is-age/
  index.ts
  index.spec.ts
  index.en.md
  index.ko.md
is-birth-date-6/
  index.ts
  index.spec.ts
  index.en.md
  index.ko.md

thank you for good suggestion!!

This is a really good method, but... There are many cases when I developing I find files by looking for Cmd+P on vscode. Would it be easy to find files if I implemented it like this?

image

I think it's okay! If others agree, I think it would be good to divide folders by domain and put doc files(en,ko), test codes, and actual files in them!

There are all the files in one domain, so it's neat as you suggested

okinawaa avatar Oct 16 '22 04:10 okinawaa

Yes, I think we might try this. I think merging the pull request as is is not bad, so I will merge it right now. Feel free to open another pull request!

raon0211 avatar Oct 16 '22 14:10 raon0211

Thx! Have a good day

okinawaa avatar Oct 16 '22 20:10 okinawaa