Coder Social home page Coder Social logo

Locales Support about falso HOT 13 CLOSED

NetanelBasal avatar NetanelBasal commented on May 18, 2024
Locales Support

from falso.

Comments (13)

michaelxvoelker avatar michaelxvoelker commented on May 18, 2024 2

I started to work on it. Would provide a draft PR over the weekend. ๐Ÿ˜Š

from falso.

NetanelBasal avatar NetanelBasal commented on May 18, 2024 1

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

from falso.

NetanelBasal avatar NetanelBasal commented on May 18, 2024 1

Yes, but they will be imported from the main package

from falso.

shhdharmen avatar shhdharmen commented on May 18, 2024

I can check this.

from falso.

iamandrewluca avatar iamandrewluca commented on May 18, 2024

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

from falso.

NetanelBasal avatar NetanelBasal commented on May 18, 2024

@theryansmee do you think you can handle this?

from falso.

theryansmee avatar theryansmee commented on May 18, 2024

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

from falso.

iamandrewluca avatar iamandrewluca commented on May 18, 2024

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

from falso.

NetanelBasal avatar NetanelBasal commented on May 18, 2024

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

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

from falso.

iamandrewluca avatar iamandrewluca commented on May 18, 2024

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 ๐Ÿค”

from falso.

iamandrewluca avatar iamandrewluca commented on May 18, 2024

Main folder will be something like this
image

And each locale subfolder, something like this ๐Ÿค”

image

from falso.

NetanelBasal avatar NetanelBasal commented on May 18, 2024

yes

from falso.

irg1008 avatar irg1008 commented on May 18, 2024

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

from falso.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.