Laravel faker repeating same name - laravel

Laravel framework: v8.12
fakerphp/faker: v1.9.1
If I change the 'faker_locale' => 'en_SG',
The $this->faker->name(); in the factory always generates John Doe or Jane Doe, nothing else.
How can I get other names in my db seeding?
Tried changing the locale gives variety of names.

It's because the locale you're using doesn't have any predefined fake names. You can check the code here: https://github.com/FakerPHP/Faker/blob/main/src/Faker/Provider/en_SG/Person.php
Compare this to the locale en_US here: https://github.com/FakerPHP/Faker/blob/main/src/Faker/Provider/en_US/Person.php to understand the difference.
The only way to make it work is to contribute to the package by improving it with fake names for this locale. Or you need to use some other locale that has enough fake data.

Related

Google maps API avoid translation of name

I'm using the places api to search for places and quickly copy the some customer information into the front-end of my application.
But sometimes, the name gets translated to English, which is not desirable for the user. How can I avoid the translation of certain places?
For instance: Krankenhaus Göttlicher Heiland will be translated to: Hospital of the Divine Savior. It kinda sounds cool, but it's not what the user wants... :)
I know it takes default my browser settings and that you can add language on in the parameters, but I want to turn that off completely. So get the original native names.
Any idea?

Magento Translation

I have Magento 1.8.1.0. Recently I've installed Russian pack, the result wasn't appropriate enough, cause some phrases on frontend remained in English
I know there's handy way to translate Magento using cvs-files.
The question is where I can find proper cvs-file? Does installed theme concerns translation some how? I know I'm asking newbie questions, I've read several posts, but I haven't made up my mind how to translate Magento.
Many thanks in advance.
Hope you are doing well,
As i have gone through your question that you want to translate your websites front end in Russian if user has selected the language Russian.
For this you are required to work out the translate.csv files which will be available in your theme Package.
Example : app/design/frontend/default/SecuareWeb/locale/de_DE
In the locale folder you will find the folder for Russian language open that folder and you will find the file where you are required to add the required translation text in it.
How to add translation text in translate.csv file is given below.
Example:
"This is the demo of translation in Russian","Это демо-трансляции на русском языке"
And one thing i would like add is that make sure your front end .phtml files must contain the text in $this->__("Example");. If you have added all the text like this then only then it will allow you for translation other wise it will not translate a text.
Hope this might be use full to you !!!
Waiting for your valuable comments in regards to your Question !!!
There are different ways to achieve translation in Magento so you can find multiple directory containing static csv files and also a database table.
All the modes have same structure: key/value. For example: "String to translate","String translated".
Inline Translation (database table: core_translate):
following best practices in Magento, you should use inline-translation aka database saved translation in rare cases. It is harder to mantain and can be buggy. It has first precedence, so any translation you do via inline translation will override the other 'modes'.
Theme level Translation (file in app/design/frontend/your_package/your_theme/ru_RU/translate.csv):
you can place any string to be translated in the translate.csv. It has second precedence.
Locale translation (file in app/locale/ru_RU/Module_Name.csv):
the suggested way to do translation as it will keep translation separated by each module and is easier to maintain. For example: Mage_Catalog.csv etc.
Each module in Magento can specify its csv file containing translation and sometimes the same string has different modules trying to translate, so if your translation does not work check between multiple file by a quick editor search. It will be overridden by the two above modes.
Note:
Magento will load all the csv files and build up a giant tree and caches it. So before scratching your head because the string is not translated as you wished in the frontend:
1. clean the cache.
2. check for any same key string which comes after your translated string. For example: in the same csv Line 100 will override Line 1 if the key string are the same.
3. check for any same key string in the mode which has higher precedence. For example: inline translation will override any csv based translated string.
It may be easier for you to go to the admin backend System -> Configuration -> Developer and switch "Translate Inline" "Enabled for Frontend" to "Yes".
Then, refresh the frontend and you can change the translation directly at your web browser.
The translation is saved in the database table core_translate just for the case you want to do it in a test environment and copy the translation later on to the production.
Take care that without client restrictions (System -> Configuration -> Developer) everyone will see the translation options.
btw. You may need to clear the cache and refresh the webpage in order to see your changes.

Remove default language in Magento

I am in the following bind:
A client wanted 3 languages - English, Russian and Latvian. Naturally, I created 3 store views and changed the language for each. Once I had translated everything via the inline-translate tool, and the client added the products with descriptions in all of the languages,the client had a change of heart, and now wants English to be removed.
Now this is a problem, since it is the default Store view, and can;t be deleted as such. i have thought of just changing the titles and locales of the languages, but that would still leave the product descriptions wrong.
Is there a way to do this, either via DB, or some other way?
TL; DR: How to remove the default store view in Magento?
Try to change "Default Storeview" for your default "Store". Go to "System/Manage Stores", choose your store and change "Default storeview" to Russian or Latvian. Then you could be able to delete English storeview.

magento 1.7 language code issue

I have Magento store (1.7-community) with two store views.
On English side prices look like $999,99. On french side prices look like 999,99 $CA.
I would like to get rid of CA.
in \lib\Zend\Locale\Data\fr_CA.xml
currency pattern looks like this
<pattern>#,##0.00 ¤;(#,##0.00 ¤)</pattern>
I tried changing this and even removing the section. Flushed caches and deleted var/cache. I am not even sure where CA suffix comes from.
But it does not go away.
Is there an over-ride, Is there a database table that can be cleared?
Maybe you have configured the currency wrong? It might be canadian dollars you have now instead of US dollars. Have a look at the configuration.
If the locale of your store view is set to French (France) rather than French (Canada) you will see this. I just stumbled across it because the fr_FR translation is more complete than the fr_CA one and so I often use it instead and didn't consider issues like this.

Java Playframework Internationalization doesn't work

I used the instructions from here:
http://www.playframework.org/documentation/1.2.1/i18n
and created files for different languages.
I call play.i18n.Lang.change method to change the language file,
and it still takes the captions from the English file ("messages" without a suffix),
Any ideas why?
It is hard to know from your description exactly what the problem may be, so I have outlined how you should do a multi-lingual app.
There are a number of steps you must follow to get internationalisation to work. Firstly, you must change your application.conf file to declare your supported languages.
So, if you are supporting English and French, you would do
application.langs=en,fr
You must then create the language file for your French translation called messages.fr. The English language would just stay in the standard messages file. In this new file, add your name value pairs for the key and message.
The way Play processes the messages, is to look first in the locale specific message file first (so for english it would be messages.en, which does not exist, and for french it would be messages.fr). If the message cannot be found in the locale specific message file, it will look at the global message file. So your global messages file acts as the catch all.
Then, in your code, set the language for your particular user, using
Lang.change("fr"); // change language to French
Remember, that this will save a cookie for the particular user in a PLAY_LANG cookie, so check that this cookie is being created for the user.
Final note, make sure that your files are UTF8 encoded. It causes problems if it is not.
In my specific case I had
play.http.session.domain
set to something else other than localhost while testing.

Resources