Comments (18)
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.
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.
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.
Hm, interesting. Might be a nice pull-request to add that feature. I'll check that next week ;)
from faker.
Want me to work on a PR?
from faker.
To localize catchPhrase()
in French? With pleasure.
from faker.
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.
Probably. You'll have to compare the English and the French formatters.
from faker.
I've been reviewing the library to test for unimplemented formatter and here are my thoughts:
- I'm a bit puzzled on how to implement the catchPhrase formatter (damn french grammar ...)
- We could add some formatters specific to France: Address->region, Address->department, Company->SIREN, Company->SIRET, Company->RCS
- 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.
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.
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.
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.
Ok for apparently valid data (it's the easiest way). And ok for the wiki :)
How does it work?
from faker.
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.
Great! Go for it.
from faker.
At this rate, you could also create a placeholder for "ET" : "mais surtout", "sans oublier", "avec", and so on.
from faker.
That's right, I'll do that tonight :)
from faker.
Fixed in 2fa2cf8
from faker.
Related Issues (20)
- How to generate a column data depend on other column data HOT 1
- eCommerce Feature request HOT 1
- Doctrine Populator: Don't clean entity manager HOT 1
- Kz faker random wrong output from getCenturyByYear
- [BUG] dateTimeThisYear method does not generate a properly date with current year
- Got 'Unknown formatter "tollFreePhoneNumber"' using es_ES locale HOT 1
- Unknown formatter secondaryAddress does not exist HOT 1
- Improvement maybe: Fill any object you want.
- Maximum retries of 10000 reached without finding a unique value HOT 1
- Suggestion - Faker method to randomly execute HOT 1
- Feature request: Codes for the representation of names of scripts (ISO 15924)
- dateTimeThisDecade is previous decade HOT 2
- Add zh_CN PhoneNumber TestCase & TollFreePhoneNumber API & E164PhoneNumber API
- Doctrine\Common\Persistence\ is Deprecated in 5.0 Symfony
- Undefined type 'Database\Seeders\Faker\Factory'.intelephense(1009) HOT 1
- buildingNumber is 0, 00, 000 in some locales
- In DatabaseServiceProvider.php line 88: Class 'Faker\Factory' not found HOT 2
- [Feature request] Add profanity and rude words generator HOT 6
- Lorempixel.com is down HOT 2
- Set next as default branch
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from faker.