<commit_before>import { Component, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';

import { langConfig } from '../config/lang.config';
import { LocalizeRouterService } from 'localize-router';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {

  constructor(private translate: TranslateService,
              private localize: LocalizeRouterService) {
  }

  ngOnInit() {
    // get app languages and set current language
    this.translate.addLangs(langConfig.languages);
    this.translate.setDefaultLang(langConfig.defaultLang);
  }

  onChangeLang(lang) {
    this.localize.changeLanguage(lang);
  }

}<commit_msg>feat(html[lang]): change attribute lang of html dynamically<commit_after>import { Component, Inject, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';

import { langConfig } from '../config/lang.config';
import { LocalizeRouterService } from 'localize-router';
import { DOCUMENT } from '@angular/platform-browser';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {

  constructor(private translate: TranslateService,
              private localize: LocalizeRouterService,
              @Inject(DOCUMENT) private document) {
  }

  ngOnInit() {
    // get app languages and set current language
    this.translate.addLangs(langConfig.languages);
    this.translate.setDefaultLang(langConfig.defaultLang);
    this.changeLangAttr(this.translate.currentLang);
  }

  /**
   * update app lang
   * @param lang
   */
  onChangeLang(lang) {
    this.localize.changeLanguage(lang);
    this.changeLangAttr(lang);
  }

  /**
   * Change lang attr for head tag on change app lang
   * @param lang
   */
  changeLangAttr(lang) {
    this.document.getElementsByTagName('html')[ 0 ]
      .setAttribute('lang', lang);
  }

}
{'fraction_non_alphanumeric': 0.1221881390593047, 'fraction_numerical': 0.0005112474437627812, 'mean_word_length': 3.8925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5685898', 'n_tokens_mistral': 574, 'n_tokens_neox': 564, 'n_words': 128}