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

Locales Support #1

Closed
NetanelBasal opened this issue Jan 9, 2022 · 13 comments
Closed

Locales Support #1

NetanelBasal opened this issue Jan 9, 2022 · 13 comments
Assignees
Labels
enhancement New feature or request

Comments

@NetanelBasal
Copy link
Member

Description

Add locales support

Proposed solution

Generate data via google translate?

Alternatives considered

?

Do you want to create a pull request?

No

@NetanelBasal NetanelBasal added the enhancement New feature or request label Jan 9, 2022
@shhdharmen
Copy link
Contributor

I can check this.

shhdharmen added a commit to shhdharmen/falso that referenced this issue Jan 10, 2022
@shhdharmen shhdharmen mentioned this issue Jan 10, 2022
1 task
shhdharmen added a commit to shhdharmen/falso that referenced this issue Jan 11, 2022
shhdharmen added a commit to shhdharmen/falso that referenced this issue Jan 11, 2022
shhdharmen added a commit to shhdharmen/falso that referenced this issue Jan 11, 2022
@iamandrewluca
Copy link
Contributor

iamandrewluca commented Jan 11, 2022

I saw PR related to this issue. That's very cool that we can use Google Translate to translate. But in terms of library API, how this will work taking into consideration that needs to be tree shakeable? 🤔

import { locale } from '@ngneat/falso'

// Something like this?
locale('en')

or maybe we can generate per locale bundles? 🤔
and the default @ngneat/falso is English version

import { randomWord } from '@ngneat/falso/de'
randomWord()

or we can make everything that is not translateable to be imported from @ngneat/falso
and everything else that is translateble to be imported from @ngneat/falso/<locale>

I like more this third option

@NetanelBasal
Copy link
Member Author

Yes, the next step should be the third option using second entry points.

shhdharmen added a commit to shhdharmen/falso that referenced this issue Jan 12, 2022
shhdharmen added a commit to shhdharmen/falso that referenced this issue Jan 12, 2022
shhdharmen added a commit to shhdharmen/falso that referenced this issue Jan 12, 2022
shhdharmen added a commit to shhdharmen/falso that referenced this issue Jan 12, 2022
shhdharmen added a commit to shhdharmen/falso that referenced this issue Jan 12, 2022
shhdharmen added a commit to shhdharmen/falso that referenced this issue Jan 12, 2022
shhdharmen added a commit to shhdharmen/falso that referenced this issue Jan 12, 2022
shhdharmen added a commit to shhdharmen/falso that referenced this issue Jan 18, 2022
@shhdharmen shhdharmen mentioned this issue Jan 18, 2022
1 task
shhdharmen added a commit to shhdharmen/falso that referenced this issue Jan 19, 2022
@NetanelBasal
Copy link
Member Author

@theryansmee do you think you can handle this?

@theryansmee
Copy link
Collaborator

@NetanelBasal - Sorry I don't have any experience with this. It would probably be better suited for someone else.

@iamandrewluca
Copy link
Contributor

iamandrewluca commented Feb 10, 2022

What would be the approach here. Using fileReplacements or ENV properties to replace default locale e.g. en.json with de.json and do builds for each locale?

Wouldn’t it be better for functions that need locales, to group them in own folder?

packages/falso/src/lib/abbreviation/index.ts
packages/falso/src/lib/abbreviation/en.json
packages/falso/src/lib/abbreviation/de.json
packages/falso/src/lib/abbreviation/<locale>.json

@NetanelBasal
Copy link
Member Author

NetanelBasal commented Feb 10, 2022

We don't want it as a separate npm package. The goal is to import it as:

import { randName } from @ngneat/falso/locales/ru

@iamandrewluca
Copy link
Contributor

iamandrewluca commented Feb 10, 2022

We don't want it as a separate npm package. The goal is to import it as:

Exactly, but each locale subfolder will be a completely different build 🤔

@NetanelBasal
Copy link
Member Author

Yes, but they will be imported from the main package

@iamandrewluca
Copy link
Contributor

Main folder will be something like this
image

And each locale subfolder, something like this 🤔

image

@NetanelBasal
Copy link
Member Author

yes

@michaelxvoelker
Copy link
Contributor

I started to work on it. Would provide a draft PR over the weekend. 😊

@irg1008
Copy link

irg1008 commented Nov 20, 2023

Hi I am sorry but the only random value exported from locales seems to be "randomBird". Is this right?

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

No branches or pull requests

6 participants