WPML을 사용하면 wpml-config.xml 파일의 설정을 구성하여 특정 요구에 맞게 언어 전환기를 사용자 정의할 수 있습니다.
wpml-config.xml은 웹사이트에서 WPML 언어 전환기의 모양과 동작을 사용자 정의할 수 있는 구성 파일입니다. CSS 스타일 지정, 표시 설정 및 숏코드와 같은 여러 속성을 구성할 수 있습니다.
이 가이드는 내장된 WPML 언어 전환기를 사용자 정의하려는 개발자를 위한 것입니다. 사용자 정의 언어 전환기를 구축하려면 사용자 정의 언어 전환기 생성에 대한 페이지를 읽어보세요.
wpml-config.xml 파일을 생성해야 하나요? 다국어 도구 플러그인을 사용하여 구성 파일을 자동으로 생성하는 단계별 가이드를 방문하세요.
언어 전환기에서 사용자 정의할 수 있는 항목
WPML을 사용하면 언어 전환기에서 여러 변수를 사용자 정의할 수 있습니다. 여기에는 다음이 포함됩니다.
- 인라인 CSS 스타일 – 언어 전환기에 직접 사용자 정의 CSS 추가
- 번역되지 않은 콘텐츠에 대한 링크 – 번역되지 않은 콘텐츠에 대한 링크를 표시할지 또는 숨길지 결정
- 복사할 URL 매개변수 – 언어를 전환할 때 복사해야 하는 URL 매개변수 지정
- 사이드바 / 푸터 언어 전환기 – 사이드바 및 푸터에 있는 언어 전환기의 모양 구성, 포함 항목:
- 국기 및/또는 언어 이름 표시 여부
- 현재 언어를 링크로 표시할지 여부
- 언어 전환기 위젯의 제목 설정
- 전환기 레이아웃의 템플릿 선택
- HEX 색상 코드를 사용하여 텍스트, 배경 및 테두리의 색상 사용자 정의
- 숏코드 작업 – 숏코드를 통해 추가된 언어 전환기의 모양 정의
내장된 WPML 언어 전환기에 사용자 정의 구성을 추가하는 예
<wpml-config>
<language-switcher-settings>
<key name="additional_css">{inline CSS styles}</key>
<key name="link_empty">{0 or 1}</key>
<key name="copy_parameters">{parameter1, parameter2}</key>
<key name="sidebars">
<key name="{sidebar slug}">
<key name="display_flags">{0 or 1}</key>
<key name="display_names_in_current_lang">{0 or 1}</key>
<key name="display_names_in_native_lang">{0 or 1}</key>
<key name="display_link_for_current_lang">{0 or 1}</key>
<key name="widget_title">{widget title}</key>
<key name="template">{template slug}</key>
<!-- color picker keys -->
<key name="background_normal">#{hex color}</key>
<key name="border_normal">#{hex color}</key>
<key name="font_current_normal">#{hex color}</key>
<key name="font_current_hover">#{hex color}</key>
<key name="background_current_normal">#{hex color}</key>
<key name="background_current_hover">#{hex color}</key>
<key name="font_other_normal">#{hex color}</key>
<key name="font_other_hover">#{hex color}</key>
<key name="background_other_normal">#{hex color}</key>
<key name="background_other_hover">#{hex color}</key>
</key>
</key>
<key name="statics">
<key name="footer">
<key name="show">{0 or 1}</key>
<key name="display_flags">{0 or 1}</key>
<key name="display_names_in_current_lang">{0 or 1}</key>
<key name="display_names_in_native_lang">{0 or 1}</key>
<key name="display_link_for_current_lang">{0 or 1}</key>
<key name="template">{template slug}</key>
<!-- color picker keys -->
<key name="background_normal">#{hex color}</key>
<key name="border_normal">#{hex color}</key>
<key name="font_current_normal">#{hex color}</key>
<key name="font_current_hover">#{hex color}</key>
<key name="background_current_normal">#{hex color}</key>
<key name="background_current_hover">#{hex color}</key>
<key name="font_other_normal">#{hex color}</key>
<key name="font_other_hover">#{hex color}</key>
<key name="background_other_normal">#{hex color}</key>
<key name="background_other_hover">#{hex color}</key>
</key>
<key name="post_translations">
<key name="show">{0 or 1}</key>
<key name="display_flags">{0 or 1}</key>
<key name="display_names_in_current_lang">{0 or 1}</key>
<key name="display_names_in_native_lang">{0 or 1}</key>
<key name="display_link_for_current_lang">{0 or 1}</key>
<key name="display_before_content">{0 or 1}</key>
<key name="display_after_content">{0 or 1}</key>
<key name="template">{template slug}</key>
<key name="availability_text">{string like "See post translations: %s"}</key>
</key>
<key name="shortcode_actions">
<key name="display_flags">{0 or 1}</key>
<key name="display_names_in_current_lang">{0 or 1}</key>
<key name="display_names_in_native_lang">{0 or 1}</key>
<key name="display_link_for_current_lang">{0 or 1}</key>
<key name="template">{template slug}</key>
<!-- color picker keys -->
<key name="background_normal">#{hex color}</key>
<key name="border_normal">#{hex color}</key>
<key name="font_current_normal">#{hex color}</key>
<key name="font_current_hover">#{hex color}</key>
<key name="background_current_normal">#{hex color}</key>
<key name="background_current_hover">#{hex color}</key>
<key name="font_other_normal">#{hex color}</key>
<key name="font_other_hover">#{hex color}</key>
<key name="background_other_normal">#{hex color}</key>
<key name="background_other_hover">#{hex color}</key>
</key>
</key>
</language-switcher-settings>
</wpml-config>구성 파일에 이러한 섹션이 모두 있어야 하는 것은 아닙니다. 플러그인이나 테마에 적용되는 섹션만 포함하면 됩니다.
WPML 언어 전환기를 기본 설정으로 재설정
백엔드에서 언어 전환기 구성이 (초기값에서) 변경된 경우 wpml-config.xml을 사용하여 구성을 재설정할 수도 있습니다.
새로운 변경 사항을 확인하려면 WPML → 언어 페이지 하단에 있는 기본값 복원 버튼을 클릭하세요.
추가 리소스
wpml-config.xml 파일에 대해 자세히 알아보려면 언어 구성 파일 가이드를 방문하세요.
wpml-config.xml 파일을 사용하여 다른 요소를 사용자 정의하려면 다음 추가 가이드를 방문하세요.