Nodejs

 

 

1)config/plugins.ts

export default () => ({

   // i18n 플러그인 설정
   i18n: {
    enabled: true, // i18n 플러그인 활성화
    config: {
      defaultLocale: 'ko', // 기본 언어 설정 (예: 영어)
      locales: ['ko' ,'en' ], // 지원할 언어 설정 (영어, 한국어)
    },
  },

});

 

 

 

2) src/admin/app.tsx

admin/ 디렉토리에 app.tsx 파일 생성

import type { StrapiApp } from '@strapi/strapi/admin';
import ko from './locales/ko.json';

export default {
    config: {
      locales: ['ko'], 
      defaultLocale: 'ko',
      translations: {
        ko,
      },
    },

    register(StrapiApp: StrapiApp) {

      if (typeof window !== "undefined") {
        const locale = localStorage.getItem("strapi-admin-language");
        if(!locale) {
          localStorage.setItem("strapi-admin-language", "ko");
          window.location.reload(); // 한 번만 리로드
        } 
      }
  
    },
    bootstrap() {},
};
  

 

 

 

3) src/admin/locales/ko.json

다음과 같은 설정으로 기본적으로  한국어 설정이 적용이 된다. 하지만 부족한 부분이 있기 때문에 

직접 번역 설정파일 적용한다.

  config: {
      locales: ['ko'], 
      defaultLocale: 'ko',
    
    },

src/admin/locales 디렉토리에 ko.json 파일 생성

 

https://github.dev/braverokmc79/strapi-cms

 

 

 

 

4) 관리자 화면 프로필 설정에서 한국어로 설정

 

 

 

 

 

 

 

 

 

 

 

 

 

about author

PHRASE

Level 60  라이트

위대한 사회란 사람들이 자기들 소유물의 양보다, 자기들 목표의 질에 더 관심을 갖는 곳이다. -린든 베인스 존슨

댓글 ( 0)

댓글 남기기

작성