확장기능:UniversalLanguageSelector

This page is a translated version of the page Extension:UniversalLanguageSelector and the translation is 14% complete.
Outdated translations are marked like this.
미디어위키 확장 기능 설명서
UniversalLanguageSelector
출시 상태: 안정
구현 사용자 인터페이스, 스킨 , 베타 기능
설명 사용자들이 언어 선택하는 것을 허용 하거나 사용자들의 언어 지원을 쉽게 구성 할 수 있게 해주는 도구.
만든 이 Wikimedia 언어 팀
최신 버전 2024-07-16
호환성 정책 Master maintains backward compatibility.
MediaWiki >= 1.41.0
Composer mediawiki/universal-language-selector
라이선스
다운로드 언어 확장기능 번들에 포함됨
  • $wgULSWebfontsEnabled
  • $wgULSGeoService
  • $wgULSLanguageDetection
  • $wgULSAnonCanChangeLanguage
  • $wgULSEnable
  • $wgULSImeSelectors
  • $wgULSIMEEnabled
  • $wgULSNoWebfontsSelectors
  • $wgULSFontRepositoryBasePath
  • $wgULSCompactLanguageLinksBetaFeature
  • $wgULSNoImeSelectors
  • $wgULSPosition
인터넷 익스플로러 8 또는 그 이하 버전과 호환되지 않음.
Quarterly downloads 241 (Ranked 26th)
Public wikis using 1,237 (Ranked 214th)
UniversalLanguageSelector 확장 기능 번역 (translatewiki.net에서 가능한 경우)
이슈 미해결 작업 · 버그 보고

Universal Language Selector는 사용자들이 언어를 선택하여 지원기능을 쉽게 설정할 수 있도록 해주는 도구입니다. 사용할 경우 기능적으로 WebFonts Narayam 가 포함되나, 모두 구식화되어 사용되지 않습니다. 배경적 지식이나 추가적인 정보를 확인하기 위해서는 일반 언어 선택기 를 참고하세요.

사용법

The primary aim is to allow users to select a language and easily configure its support.

The extension provides the following features:

  1. Flexible and easy way to select a language from a large set of languages.
    1. Selection can be based on geographical region-based browsing, and searching.
    1. Search can be based on ISO language code, language name written in current user interface language or in its own script(autonym)
    1. Cross-language search - search language names using any script
    1. Autocompletion of language names
    1. Auto correction of spelling mistakes in search strings
    1. Geo IP based language suggestions
    1. Language selection based on users browser/OS language
  1. Input methods
    1. An easily selectable input method collection, readily available in every editable field
    1. Provides a large set of input methods for a wide range of languages
    1. Per-language input method preferences
  1. Webfonts
    1. A large collection of fonts to choose for each language to use as an embedded font for the page
    1. Per-language font preferences
 
Universal Language Selector with geoip based language suggestion for a user from India
 
Language settings allow a registered user accessing English Wikipedia to change the UI to their native language.
 
A Bengali user is able to read content from the Bengali Wikipedia despite the lack of fonts in their computer. Web fonts are provided automatically for non-Latin scripts for which an open-source font is available. The user can decide to use their system fonts on a per-language basis.
 
A Hindi speaker without a Hindi keyboard configures input methods so that they can type in their language.
 
When searching a user can switch between English and Hindi.

글씨체 추가하기

더 많은 언어를 지원한다는 것은 코드에 적절한 글씨체를 포함해야 한다는 것을 뜻합니다. 다시 한 번 말하지만, 글씨체들은 GNU 일반 공용 사용 허가, SIL 오픈폰트라이선스 등의 기준에서 상업적으로 자유로운 글씨체만 추가됩니다. 이러한 무료 글씨체는 Google Fonts와 같은 곳에서 찾을 수 있지만, 아직 완전히 검토되지 않았거나 저작권 침해에 해당되는 글씨체일 수 있습니다. 따라서, 오픈 폰트 라이브러리 또한 확인하여 참고하세요.

무료 글씨체를 찾거나 제작해야 할 필요가 있으며 이는 무엇보다도 가장 중요하고, 당신이 직접 해야 할 일 중 하나입니다. 그 다음에는 eot, ttf, woff와 같은 적절한 형식으로 변환해야 합니다. 폰트를 확장기능에 추가하는 데 있어 파브리케이터요청 파일을 제출해야 할 수도 있습니다.

아래 웹글씨체 준비 문단으로 어떻게 글씨체를 이식할 수 있는지에 관해 설명합니다. GNU와 Linux 기반 운영체제에 대한 기본적인 지식이 필요하며 만약 이것을 따라하는 데 어려움이 있을 경우 이 단계를 건너뛰고 다른 사용자에게 파브리케이터 요청을 해줄 수 있는지에 관해 요청할 필요가 있습니다. 이 경우 절차가 지연되는 건 감안해야 합니다.

웹글씨체 준비

Creating .woff2:

Use https://github.com/google/woff2 to generate woff2 from ttf. This will produce a compressed woff2 file. Modern browsers support this format.

Create a font.ini file. Here's an example:

[AbyssinicaSIL]
languages=am*, ti*
version=1.200
license=OFL 1.1
licensefile=OFL.txt
url=http://scripts.sil.org/AbyssinicaSIL
request-url=https://phabricator.wikimedia.org/[Task Number]
woff2=AbyssinicaSIL.woff2
bold=AbyssinicaSIL Bold

[AbyssinicaSIL Bold]
woff2=AbyssinicaSIL-Bold.woff2
fontweight=bold

An asterisk (*) after a language code means that this font will be the default font for that language. Don't use the asterisk if you want the option to use this font for that language.

After creating the files, do the following:

  1. Create a directory for the font under data/fontrepo/fonts.
  1. Put the woff2 and font.ini files in that directory and add them to the source repository (git add).
  1. Go to the scripts/ directory and run php compile-font-repo.php.
  1. Commit the changes to the repository (git commit -a) and submit them according to the Git workflow.

Adding support for a new key mapping (input method)

Follow the instructions on the jquery.ime github wiki, but file requests in the Wikimedia-extensions-UniversalLanguageSelector Phabricator product.

설치

  • 파일을 다운로드하고 UniversalLanguageSelector 폴더를 extensions/ 디렉토리에 넣어 주세요.
    개발자와 코딩 기여자는 Git을 이용해 확장기능을 다운받는 것이 좋습니다.cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/UniversalLanguageSelector
  • 아래의 코드를 LocalSettings.php 코드의 마지막에 추가합니다.
    wfLoadExtension( 'UniversalLanguageSelector' );
    
  •   완료 – 위키의 ‘Special:Version’에 이동해서, 확장기능이 올바르게 설치된 것을 확인합니다.


Vagrant 설치:

  • Vagrant 를 사용하고 있는 경우에는, vagrant roles enable uls --provision로 설치해주세요

Updating LanguageNameIndex

For performing cross language search, searching autonyms, language data needs to be populated. ULS comes with a pre-populated language name index(data/langnames.ser). In case you want to update it, install Extension:CLDR and update the data with the following command.

php UniversalLanguageSelector/data/LanguageNameIndexer.php

and verify that langnames.ser file gets generated in ULS/data/ folder.

환경 설정

The following variables are created automatically during initialization and can be used from JavaScript using mw.config.get( NAME ):

  • wgULSLanguages - an associative array where the keys are language codes and the values are language names in English.
  • wgULSAcceptLanguageList - an array of language codes from the user's Accept-Language value. These are the languages selected in the user's browser preferences.

For serving fonts, you might want to add the following MIME types to your webserver if not already there. This guide might help.

AddType font/woff2 .woff2

The following variables can also be configured:

  • $wgULSGeoService - ULS can use geolocation services to suggest languages based on the country the user is visiting from. Setting this to false will prevent built-in geolocation from being used. You can provide your own geolocation by setting window. Geo to object which has key 'country_code' or 'country'. If set to true, it will query Wikimedia's geoip service. The service should return jsonp that uses the supplied callback parameter. Defaults to http://freegeoip.net/json/ (warning: this website has shut down its API) and expects the same format.
  • $wgULSEnable - Enable language selection, compact language links, input methods, and web fonts for everyone unless the behavior is overridden by the configuration variables below. Even if false, the classes and resource loader modules are registered for using other extensions. Language changing via cookie or setlang query parameter is not possible.
  • $wgULSAnonCanChangeLanguage - Allow anonymous users to change the language with cookie and setlang query param. Do not use it if you are caching anonymous page views without taking cookies into account. It does not have any effect if either $wgULSEnable or $wgULSEnableAnon is set to false.
  • $wgULSIMEEnabled - Disable the input methods feature for all users by default. The user can still enable it manually.
  • $wgULSPosition - The location and the form of the language selection trigger. The possible values are: personal: as a link near the username or the login link in the personal toolbar (default). interlanguage: as an icon near the header of the list of interlanguage links in the sidebar.
  • $wgULSNoImeSelectors - Array of jQuery selectors of elements on which IME must not be enabled. eg: [ '#wpCaptchaWord' ];
  • $wgULSLanguageDetection - Whether to automatically detect the user's language from the Accept-Language header.

Position of ULS trigger

  • $wgULSPosition - The location and the form of the language selection trigger. The possible values are: personal: as a link near the username or the login link in the personal toolbar (default).

interlanguage: as an icon near the header of the list of interlanguage links in the sidebar.

It is also possible to have a ULS trigger anywhere on the screen. An element with uls-settings-trigger will act as a ULS trigger.

Overriding default fonts

ULS has a large font repository to serve as webfonts. Sometimes, there are multiple fonts for a language, and there is a default font for each language/script. The order of fonts or default font can be overridden as follows using global scripts (MediaWiki:Common.js) or personal scripts (Special:MyPage/common.js):

$.webfonts.repository.languages.languageCode = ["system", "FontA", "FontB"];

Here, languageCode should be a valid langauge code(eg: en, hi, nl). FontA and FontB are fonts available in font repository. In the above example for languageCode, we set a font available in local computer as default font. ie No default webfont.

캐쉬 설정

To ensure that the web fonts files are cached on the clients' machines, font file types must be added to the web server configuration. In Apache2 this consists of:

  • Adding font file extensions to the FileTimes regex at FilesMatch for the relevant directory, example:
<FilesMatch "\.(gif|jpe?g|png|css|js|woff2|svg)$">
  • Adding ExpiresByType values to the relevant MIME types, similarly to image MIME types.
    • Note that there's no standard MIME type for TTF. application/x-font-ttf is used for Wikimedia.
  • Adding the MIME types:
AddType font/woff2 .woff2

내용 번역

UniversalLanguageSelector is one of the dependencies of the 번역 extension, which uses it for several language selection features. One of it is the MyLanguage system for links, which depends on the interface language of the user, but more can be configured: see Page translation feature.

웹폰트 사용

Users can choose web fonts for a language from the Language settings -> Display settings. The first font in that menu will be applied to the wiki by default. A user can change the font to be remembered across the pages. Optionally, the user can disable the font embedding by selecting the system font.

If the font is available in the user's local system, the font will not be downloaded from the MediaWiki server. It will be taken from the user's computer. Otherwise, the font will be downloaded from the server only once, when the user selects the font the first time. From then on, the font will be taken from the local cache.

Alternate ways to load fonts

By specifying font-family

Inside the wiki text <span style="font-family:'YourFontName';">YourText</span>, webfonts extension will check whether the font is available with the extension, if so it will download it to the client. So the reader will not face any difficulty reading the text even if the specified font is not available on their computer.

By specifying language

Inside the wiki text <span lang="my">YourText</span>, the web fonts extension will check whether any font is available for the given language with the extension and if so, it will download it to the client. So the reader will not face any difficulty reading the text even if the specified font is not available on their computer. The default font will be used if there are multiple fonts for the language. If the default font is not preferred, use the font-family approach to specify the font. If the tag has both lang and font-family definitions, font-family gets precedence.

예시:

<span lang=sux>𒄖𒉈𒅁𒌨𒅎</span>

gives the text rendered in Cuneiform using Akkadian font

𒄖𒉈𒅁𒌨𒅎

같이 보기