GithubHelp home page GithubHelp logo

Comments (18)

fzaninotto avatar fzaninotto commented on August 15, 2024

yes, this formatter is not implemented in the French localization. Would you like to work on a PR for it?

In the meantime, use an en_GB localized faker to get a catchPhrase.

from faker.

iammichiel avatar iammichiel commented on August 15, 2024

In fact, the default behaviour before was that if the formatter didn't exist in that language, it simply returned the default one. (en_US?)

IMO that was the good way of handling things.

from faker.

fzaninotto avatar fzaninotto commented on August 15, 2024

The default behavior was to use the provider of the default language if it is not available in the current language. But once a provider is added to the generator, there is no fallback at the formatter level. So there was no change in the fallback method - just a new, and incomplete, localized formatter.

And it's not possible to do what you suggest: if the generator fails to find a formatter, how can this generator know which provider to use to find it with the default locale?

from faker.

iammichiel avatar iammichiel commented on August 15, 2024

Hm, interesting. Might be a nice pull-request to add that feature. I'll check that next week ;)

from faker.

geoffrey-brier avatar geoffrey-brier commented on August 15, 2024

Want me to work on a PR?

from faker.

fzaninotto avatar fzaninotto commented on August 15, 2024

To localize catchPhrase() in French? With pleasure.

from faker.

geoffrey-brier avatar geoffrey-brier commented on August 15, 2024

Ok I'll do that in a couple of days. Besides, are they any other formatter which need to be translated in French?

from faker.

fzaninotto avatar fzaninotto commented on August 15, 2024

Probably. You'll have to compare the English and the French formatters.

from faker.

geoffrey-brier avatar geoffrey-brier commented on August 15, 2024

I've been reviewing the library to test for unimplemented formatter and here are my thoughts:

  1. I'm a bit puzzled on how to implement the catchPhrase formatter (damn french grammar ...)
  2. We could add some formatters specific to France: Address->region, Address->department, Company->SIREN, Company->SIRET, Company->RCS
  3. We could improve the Company->companySuffix formatter (by translating missing words compared to the en_US formatter such as 'and Sons')

Got any ideas for the first point? What do you think about the 2 last points?

from faker.

fzaninotto avatar fzaninotto commented on August 15, 2024

For the French catchPhrase, you have to start with examples of what you want to generate, find a pattern, and then populate the dictionaries for each of the elements of the pattern. For instance:

  • Toujours en avance sur le principal
  • Jamais à cours sur le formidable
  • Evidemment la référence sur le meilleur

=> the pattern is

{{timeAdverb}} {{bsPrefix}} {{bsSuffix}} 

I'm all for adding more language-specific formatters, like the ones you suggest.

from faker.

geoffrey-brier avatar geoffrey-brier commented on August 15, 2024

Ok I'll try to think about a few patterns for the catchphrase.
Right now, I have implemented regions and departments formatters and while I was looking at siren and siret generation it came up that it was a bit 'complex', so here is my question: should I generate an invalid siret/siren number (easier) or should I ensure myself of the contrary?
I was also wondering where I should put the documentation for formatters specific to a country.

from faker.

fzaninotto avatar fzaninotto commented on August 15, 2024

Your generator must create "apparently valid" data, you're not forced to create "exactly valid" ones.

As for the documentation for country-specific formatters, I have not thought about this. Perhaps the wiki?

from faker.

geoffrey-brier avatar geoffrey-brier commented on August 15, 2024

Ok for apparently valid data (it's the easiest way). And ok for the wiki :)
How does it work?

from faker.

geoffrey-brier avatar geoffrey-brier commented on August 15, 2024

Here is what I was thinking for the catchPhrase formatter:

<?php
...
protected static $catchPhraseFormats = array(
        '{{noun}} {{verb}} {{attribute}}',
        '{{noun}} ET {{noun}} {{attribute}}',
        '{{noun}} ET {{noun}} {{mutipleAttribute}}',
    );
protected static $noun = array('la sécurité', 'le plaisir', "l'ambiance", "l'efficacité", 'le confort', 'la simplicité', 'la qualité', "l'assurance", 'la santé', 'la technologie', "l'art", 'le pouvoir', 'le prestige', "l'honneur", 'la chance',  'la faculté', 'la possibilité', 'le droit', "l'avantage", 'la liberté');

protected static $verb = array('de rouler', "d'avancer", "d'évoluer", 'de changer', "d'innover", 'de louer', "d'atteindre vos buts", 'de concrétiser vos projets');

protected static $attribute = array('moins cher', 'plus efficacement', 'plus rapidement', 'plus facilement', 'plus simplement',  'en toute tranquillité', 'avant-tout', "d'abord", 'autrement', 'naturellement', 'à la pointe', 'sans soucis', 'supérieurs', "à l'état pur", 'à sa source', 'sûre', 'pour la vie');

protected static $multipleAttribute = array('sont nos priorités',  'sont nos points forts', 'font notre force', 'qui assurent', 'sont nos passions');
...

This way, we'll have catch phrases which could be similar to :

  • La sécurité et l'efficacité avant tout
  • Le plaisir d'avancer autrement
  • Le simplicité et la qualité à l'état pur

What do you think about that?

from faker.

fzaninotto avatar fzaninotto commented on August 15, 2024

Great! Go for it.

from faker.

vendethiel avatar vendethiel commented on August 15, 2024

At this rate, you could also create a placeholder for "ET" : "mais surtout", "sans oublier", "avec", and so on.

from faker.

geoffrey-brier avatar geoffrey-brier commented on August 15, 2024

That's right, I'll do that tonight :)

from faker.

fzaninotto avatar fzaninotto commented on August 15, 2024

Fixed in 2fa2cf8

from faker.

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.