Skip to content

Instantly share code, notes, and snippets.

View Alanch8's full-sized avatar
🗻
Focusing

Aitor Lancharro Alanch8

🗻
Focusing
View GitHub Profile
@Alanch8
Alanch8 / multilanguage.md
Last active April 10, 2023 08:27
How to implement multilanguage support - Angular Application

I have decided to create this Gist to explain how I have done the installation and configuration of the translation module. I do it as an update of the original post since I have found errors due to the fact that it is from 2020. To do so, I will simply describe how I have done it from the previous tutorial.

Original post from 2020: https://www.alphabold.com/how-to-implement-multilanguage-support-in-an-angular-application/

  1. CREATE AN ANGULAR APPLICATION Let us create an angular application for this implementation. Make sure you have npm install in the project directory, if not run ‘npm install’ in the project directory. After you have installed npm, let’s create a new angular application using ‘ng new . Once created cd
@Alanch8
Alanch8 / bootstrap-angular.md
Created March 28, 2023 18:14
How to definitely install Bootstrap in Angular

There are many ways to install bootstrap in Angular.

You can do it with CDN or with a module package like Npm or Yarn.

However, there are different packages and ways to do it.

Also each way has its own configuration.

Therefore, I have decided that the best way to install it in a new project is using the npm ng-bootstrap library.

@Alanch8
Alanch8 / ng-translate.md
Last active April 10, 2023 08:27
How to use ng-translate

Template

<select class="form-control" #selectedLang (change)="switchLanguage(selectedLang.value)">
    <option *ngFor="let language of translate.getLangs()" [value]="language"
        [selected]="language === translate.currentLang">
        {{ language }}
    </option>
</select>
#!/bin/sh
# Gets the name of the current branch
current_branch=$(git symbolic-ref --short HEAD)
# Checks if the current branch is the main branch
if [ "$current_branch" = "main" ]; then
echo "Pushes to the main branch are not allowed."
exit 1
else
chmod +x .git/hooks/pre-commit
"scripts": {
"pre-commit": "chmod +x .git/hooks/pre-commit"
}
ng new projec-name
npm install @typescript-eslint/eslint-plugin@latest --save-dev
npm init @eslint/config
npm install --save-dev --save-exact prettier