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

Nationality & Official languages #91

Closed
Sicklou opened this issue Jul 14, 2024 · 5 comments
Closed

Nationality & Official languages #91

Sicklou opened this issue Jul 14, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@Sicklou
Copy link

Sicklou commented Jul 14, 2024

Hi,

I think the package is awesome, but I was also looking for nationality (like if you are born in France, the nationality is "French"). And also the official languages of the countries.

I'm ok to make a PR. But before, is it ok for you to add these two new information ?

Thank you for the package :)

@nnjeim nnjeim added the enhancement New feature or request label Jul 15, 2024
@nnjeim
Copy link
Owner

nnjeim commented Jul 15, 2024

@Sicklou Thank you for your input. However please take into count the multiple locales that are supported as of now.
it might be a lot of work here.
Do you have a source for the data that need to be added?

'accepted_locales' => [
		'ar',
		'bn',
		'br',
		'de',
		'en',
		'es',
		'fr',
		'hr',
		'it',
		'ja',
		'kr',
		'nl',
		'pl',
		'pt',
		'ro',
		'ru',
		'tr',
		'zh',
	],
	
	```
	
	
	

@Sicklou
Copy link
Author

Sicklou commented Jul 15, 2024

Using the Google Translate API with a python script in order to retrieve every translation ?

And where should I put the translation ? in the lang folder as "nationality.php" ?

@nnjeim
Copy link
Owner

nnjeim commented Jul 15, 2024

i am not sure about the placement of this needed field. I would rather suggest you fork the repository and try to make it work on your end first. I would help you in the re-integration when you are done.
this thing is that the countries.json file should be the source.
in your case all the nationalities should be translated to all the supported locales.
try to look at the translation of the countries names php files. it might inspire you how you would like to do it

@Sicklou
Copy link
Author

Sicklou commented Jul 16, 2024

Thanks for the reply.

I just forked the project. But I'm not sure of how I can test it.
Did I need to do it as a standalone ? or inside a Laravel test app ?

As a standalone, tests doesn't work. I'm a little confused about how I can work on the package.

@nnjeim
Copy link
Owner

nnjeim commented Jul 17, 2024

Thanks for the reply.

I just forked the project. But I'm not sure of how I can test it. Did I need to do it as a standalone ? or inside a Laravel test app ?

As a standalone, tests doesn't work. I'm a little confused about how I can work on the package.

Hi again,
I personally develop the package as below.
1- install laravel app
2- create a folder where the name represents the 1st level domain name. in my case it is nnjeim
3- clone the repository inside nnjeim it will create the folder world where all the files are present
4- you need to modify the package composer.json to reflect your new domain names.

{
    "name": "nnjeim/world",
    "description": "Laravel countries, states, cities and currencies",
    "keywords": [
        "laravel",
        "lumen",
        "countries",
        "cities",
        "states",
        "timezones",
        "currencies"
    ],
    "homepage": "https://github.com/nnjeim/world.git",
    "license": "MIT",
    "type": "laravel-package",
    "authors": [
        {
            "name": "Najm Njeim",
            "email": "[email protected]",
            "role": "Developer"
        }
    ],
    "require": {
        "php": ">=7.4"
    },
    "require-dev": {
        "orchestra/testbench": ">=v4.0.0",
        "phpunit/phpunit": ">=8.5.8"
    },
    "autoload": {
        "psr-4": {
            "Nnjeim\\World\\": "src/",
            "Nnjeim\\World\\Database\\Seeders\\": "src/Database/Seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Nnjeim\\World\\Tests\\": "tests/"
        }
    },
    "scripts": {
        "test": "vendor/bin/phpunit",
        "test-coverage": "vendor/bin/phpunit --coverage-html coverage"
    },
    "config": {
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "providers": [
                "Nnjeim\\World\\WorldServiceProvider"
            ],
            "aliases": {
                "Country": "Nnjeim\\World\\World"
            }
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

5- In laravel's main composer.json i have added the below

 "repositories": [
        {
            "type": "path",
            "url": "./nnjeim/world"
        },
    ]
    ```
    6- finally you need to run composer update at the root of the laravel's app to update all the above 

@nnjeim nnjeim closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2024
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

2 participants