3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AngularでFroala Editorを日本語にする設定方法

Last updated at Posted at 2019-02-05

Angularのインストール手順は省きます。すいません。

Angularでwysiwygエディタを作るために
Froala Editorangular-froala-wysiwygというライブラリを使います。

1.npm install

npm install angular-froala-wysiwyg

2.インストールが完了したら設定ファイルに追記

app.module.ts
import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
 
 imports: [
   ...
   FroalaEditorModule.forRoot(),
   FroalaViewModule.forRoot()
 ]
 
.angular.json
  "styles": [
    "styles.css",
    "../node_modules/froala-editor/css/froala_editor.pkgd.min.css",
    "../node_modules/froala-editor/css/froala_style.min.css",
    "../node_modules/font-awesome/css/font-awesome.css"
  ],
  "scripts": [
    "../node_modules/jquery/dist/jquery.min.js",
    "../node_modules/froala-editor/js/froala_editor.pkgd.min.js",
    "../node_modules/froala-editor/js/languages/ja.js"
  ],
 

scriptsで"ja.js"を読み込ませていますが、これがFroala Editorを日本語化するためのファイルになります。他の言語も用意されています。詳しくはこちら

3.エディタを表示させるコンポーネントファイルに追記

hoge.component.ts
import { Component, OnInit } from '@angular/core';

@Component({
  ...,
  template: `<div [froalaEditor]="options"></div>`
})
export class AdminComponent implements OnInit {

  public options: Object = {
    language: 'ja',
  };

  constructor() { }

  ngOnInit () {
  }
}

optionsに"language"で"ja"を指定して完成です。

Screen Shot 2019-02-05 at 19.08.38.png
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?