Global templates/Proposed specification/tr

  Татары, узбеки и ненцы И весь украинский народ, И даже приволжские немцы К себе переводчиков ждут. И может быть в эту минуту Меня на турецкий язык Японец какой переводит И в самую душу проник. —Осип Мандельштам

Bu, küresel şablonlar ve modüller için işlevsel gereksinimler için bir tekliftir.

Ayrıca bu teklifin tek sayfalık bir sürümünü de okuyabilirsiniz.

'''Bu, herhangi bir zamanda herhangi bir zamanda herhangi bir kişi tarafından yürütülmekte veya yürütülmesi planlanan bir proje değildir, en azından henüz değil. Çok detaylı da olsa bu sadece bir fikir.'''

Nihai amaç, uygun mimari, ürün ve proje yönetimi, topluluk katılımı vb. ile bunları uygulama konusunda ekipler arası ve projeler arası bir taahhüt oluşturmaktır.

Bu belge, depolama, önbellekleme, dağıtım, PHP kod tasarımı vb. bakımından teknik uygulamanın ayrıntılarına girmeye çalışmaz. Yalnızca bu özelliğin kullanıcılar açısından nasıl çalışacağıyla ilgili gereksinimleri tanımlamaya çalışır:


 * 1) Şablon ve modül oluşturan ve bakımını yapan kişiler.
 * 2) Şablonları ve modülleri aşan sayfalar oluşturan ve düzenleyen kullanıcılar. Bu, tüm editörleri ve her türlü sayfayı içerir:
 * 3) * Tüm deneyim seviyeleri: tamamen yeni olanlardan binlerce düzenleme yapanlara
 * 4) * Her türlü düzenleme aracı: viki sözdizimi düzenleme, Görsel Düzenleyici, İçerik Çevirisi ve diğerleri (hatta bot operatörleri)
 * 5) * Tüm vikiler: Vikipedi, Vikisözlük, Vikigezgin, Vikiveri, Incubator, vb. ve gelecekteki yeni projeler
 * 6) * Tüm diller: İngilizce, Fransızca, Rusça, İspanyolca, Ermenice, Farsça, Zulu, Manipuri, vb.
 * 7) * Her türlü sayfa: Vikipedi maddeleri, madde tartışma sayfaları, kullanıcı mesaj sayfaları, topluluk tartışma sayfaları, Vikiproje sayfaları, kategoriler, şablon belge sayfaları vb.

Asansör aralığı
Wikimedia sitelerinin işlevselliğinin büyük bir kısmı şablonlarda ve Lua modüllerinde uygulanmaktadır. Mevcut haliyle farklı vikiler ve diller arasında paylaşılamazlar. Bu nedenle, Görsel Düzenleyici, Vikiveri ve İçerik Çevirisi gibi maddeler oluşturmanın ve düzenlemenin modern yollarıyla entegre etmek zordur. Ayrıca mobil cihazlara uyum sağlamak da zordur. Bu, katkıda bulunanların çabalarının boşa gitmesine ve yeni editörler ve daha küçük projeler için zorluklara neden olur. Commons görüntülerine benzer şekilde bunları wiki sitelerinde paylaşmak mümkün olmalıdır. Bu, yazılım geliştirmeyi daha hızlı ve daha sağlam hale getirecek ve editörlerin yazmaya daha fazla odaklanmalarını sağlayacaktır.

Sorun
Genel yorum: Aksi belirtilmedikçe, “şablonlar”'a yapılan tüm atıflar Scribunto Lua modülleri için de geçerlidir.

Şablonlar, Wikimedia sitelerinin özelliklerini uygular. Bu özelliklerin bazıları, özellikle bilgi kutuları, kaynakça, “gerekli atıflar” ve diğerleri gibi oldukça belirgindir. Tüm okuyucular onları görür ve tüm editörler hemen hemen her düzenleme eyleminde bunlara rastlar. Ayrıca, sitelerin dahili topluluk yönetimi özelliklerinin çoğunu uygularlar: silme istekleri, engellemeyi kaldırma istekleri, tartışmalarda desteği ifade etme, Vikiprojeler için maddeler sıralama vb.

Şablonlar, birçok sayfada yinelenen metin ve işaretleme parçalarını hızlı bir şekilde tasarlamak, dağıtmak ve kullanmak için etkili bir mekanizma sağlar. Bununla birlikte, şablonların her türlü editör için birkaç akut kullanılabilirlik sorunu vardır.

Viki sözdizimi editörleri
Viki sözdizimindeki editörler için şablonları anlamak genellikle zordur. Belirli bir şablonu kullanma konusunda deneyimli kişiler muhtemelen şablonu tanıyacak ve bunu içeren bir sayfayı düzenleyebileceklerdir. Bununla birlikte, bu şablona aşina olmayan editörlerin, genellikle düzenleme ve diğer şablonlarla deneyimli olsalar bile, karşılaştıklarında belgelerine bakmaları gerekecektir. Ve düşük deneyime sahip editörler, kıvırcık parantez, boru karakterleri, eşit işaretler vb. İle parolalı metin tarafından şaşkına dönecektir.

Şablon olarak uygulanan bir özelliği kullanmak için şablonun adını bilmek ve bunu süslü parantez içine yazmak ( – ) veya başka bir sayfadan kopyalamak gerekir. Bu yeni kullanıcılar için açık değildir ve deneyimli kullanıcılar her yeni şablonu da ayrı ayrı öğrenmek zorundadır.

Bazı vikilerde, bu projede ortak olan şablonları düzenleme araç çubuğuna ekleyen düğmeler ekleyen araçlar bulunur. Şablonların birçoğu projeler ve diller arasında benzer işlevselliğe sahip olsa da bunlar her vikide farklıdır.

Görsel Düzenleyici kullanıcıları
VisualEditor kullanıcılarının şablonları kullanma konusunda bazı avantajları vardır, ancak onlarla ilgili birçok sorun da vardır. Özellikle, benzer bir bulunabilirlik sorunu var: Görsel Düzenleyici'de, tüm şablonların işlevleri “ → ” menü öğesinin arkasında gizlidir ve kullanıcının şablonu kullanmadan önce bilmesi gerekir.

Görsel Düzenleyici'nin “” menüsünde Matematik formülleri, Mısır Hiyeroglifleri, Müzik notaları ve uzantı olarak uygulanan diğer bazı işlevler vardır, ancak “Bilgi kutusu”, “Kaynak belirtilmeli”, “Birim dönüşümü”, "Teklif" vb. gibi öğeleri yoktur. Tüm şablonlar aynı türden genel öğelerdir.

Dikkate değer bir istisna vardır: Bazı wikilerin kaynak şablonları içeren dipnotlar ekleyen “” düğmesi vardır. Ancak, kuralı ispatlayan bir istisnadır. Temel işlevler için bile manüel yapılandırma gerektirir, bu yapılandırma her wiki için ayrıdır ve sonuç olarak birçok vikide bu düğme yoktur. 2019'un sonlarında eklenen başka bir karşılaştırılabilir istisna, “Kaynak belirtilmeli” şablonlar için özel destektir, ancak bunun aynı zamanda gerçekte çalışması için her bir viki üzerinde bazı özel yapılandırmalara ihtiyacı vardır.

Birden fazla projede yazan editörler için zorluklar
 Yesterday came suddenly, tomorrow we’ll receive, Today now you’re at the wheel I’ll ask how does it feel.

Yesterday when heaven’s gates I’d contemplate they’d seem so far, Today they ain’t so far away and almost seem ajar.

Keep what ya got by giving it all away. Keep what ya got by giving it all away. Keep what ya got, Hold it, don’t stop, Keep what ya got by giving it all away. —Ian Brown Birçok şablon bir projede bulunur, ancak diğer projelerde yoktur ve genellikle bir şablon mevcuttur, ancak farklı bir formdadır. Bu nedenle, bir projede kazanılan becerileri yeniden kullanmak zor veya imkansızdır: şablonun sağladığı işlevsellik bazen mevcut değildir ve bazen farklı çalışır. Bu sadece farklı dillerdeki vikiler için değil aynı zamanda Türkçe Vikipedi ve Türkçe Vikikaynak gibi aynı dildeki farklı vikiler için de geçerlidir.

Farklı dillerde düzenleme yapan kişiler için şablonlar çeviriyi zorlaştırır. Bir sayfayı çevirirken, çevirinin elle mi yoksa İçerik Çevirisi ile mi yapıldığına bakılmaksızın, şablonların madde metninden (“nesir”) çok daha zordur. Kullanıcılar genellikle makaleyi yayınladıktan sonra şablonu atlamak veya düzeltmek zorundadır. Şablon çevirisi korkutucu göründüğünden, bu durum çevirilerin terk edilmesine de neden olur.

İçerik Çevirisinde en sık bildirilen sorunlar şablonlarla ilgilidir.

İçerik Çevirisi, bu işlemin bazı bölümlerini otomatikleştiren bir şablon uyarlama özelliğine sahiptir, ancak yalnızca her iki dilde karşılık gelen bir şablon varsa ve tüm parametreler şablon koruyucular tarafından titizlikle eşlendiyse çalışır. Bu, her dildeki her şablon için ayrı ve manüel olarak yapılmalı ve kaynak şablon değiştiğinde sürekli olarak korunmalıdır. Bu, şablonların dillerdeki işlevi çoğu zaman aynı olmasına rağmen olur.

İdeal olarak, şablonlar ve parametreleri çevrilen sayfaya neredeyse tamamen otomatik olarak aktarılmalıdır, böylece çevirmenler nesir yazmaya odaklanabilir, çünkü nesir yazmak insan çalışmasının en çok ihtiyaç duyduğu alandır.

Bir şablon bir vikiden diğerine aktarılabilir, ancak bu yapıldıktan sonra şablon çatallı bir kopya haline gelir. İhraç edildiği durumda kalır veya ayrı olarak geliştirilmeye devam ederek uyumsuzluğa neden olur. Bazen insanlar farklı kopyaları saklamaya devam ederler, ancak bu sağlam değildir ve sahip olduğumuz yüzlerce viki için ölçeklendirilemez.

Şablon parametreleri aynı işlevselliğe sahip olabilir, ancak farklı vikilerde farklı adlar olabilir. TemplateData takma adları kullanılarak uyarlanabilirler, ancak bu bir yetersiz hacktir: TemplateData'nın başlangıçta yaptığı şey değildir ve her dil çifti için manüel olarak yapılması gerekir.

Şablonlar algoritmik mantığı, okunabilir metin dizelerini ve biçimlendirmeyi bir araya getirir. Bu nedenle, MediaWiki çekirdeği ve uzantılarıyla yapıldığı için şablonların kullanıcı arayüzü dizelerini çevirmenin sağlam bir yolu yoktur.

Küçük vikilerdeki editör zorlukları
Temel MediaWiki yüklenerek ve varsayılan bir uzantı kümesi etkinleştirilerek yeni bir viki projesi oluşturulur. Pratikte bu, düz bir oyun alanı oluşturmaz, çünkü daha büyük wikilerin birçok temel özelliği şablonlarda uygulanır: bilgi kutuları, kaynaklar, bakım notları ( gibi), vb.

Yazılım geliştirici zorlukları
MediaWiki çekirdeği, uzantılar, robotlar ve viki sayfası içeriğini analiz eden, üreten veya değiştiren diğer araçlar geliştiriciler için, bir vikide belirli şablonların varlığına bağlı özellikler geliştirmek zordur. GrowthExperiments, PageTriage, ContentTranslation, Wikibase'in bazı bileşenleri ve diğerleri gibi uzantıların geliştiricileri, bunları üretimde test etmelidir, bu da kötü bir fikirdir veya şablonları yerel vikilerine veya çevrimiçi test vikilerine aktarmak zorundadır.

Şablonlara dayalı viki içeriği hakkında veri alan araştırmacılar, her bir viki için analiz kodlarını ayrı ayrı yazmak zorundadırlar ve bazen sadece bir viki için yaparlar. Dikkate değer bir örnek, sayfa konularını analiz etmek ve makale kalitesini değerlendirmek için Türkçe Vikipedi'nin Vikiproje şablonlarını kullanmaktır.

Uzantılar ve Şablonlar: Benzerlikler ve farklılıklar
Bu proje teklifinin ana varsayımlarından biri, şablonların ve modüllerin MediaWiki çekirdeğine ve uzantılarına çok benzemesidir: Yazılımdır ve editör topluluğunun ihtiyaç duyduğu özellikleri uygularlar. Özellikle, şablonlar genellikle editörler tarafından geliştirildiğinden, gerçekten topluluğunun onlara ihtiyacı olduğu açıktır. Nasıl geliştirildikleri, yerelleştirildikleri ve konuşlandırıldıkları arasındaki yalan arasındaki büyük farklardır.

Şablonlar ve modüller, şu anda sahip olmadıkları bazı önemli özelliklerde uzantılara benzer olmalı ve uzantıların eksik olduğu bazı iyi özellikleri korumalıdır. (Türkçe okuyucular tarafından kolayca anlaşılabilmesi için tabloda Türkçe Vikipedi'den şablon örnekleri verilmiştir. Ayrıca başka herhangi bir viki ve başka bir dilden de gelebilirler.)

Şablon ve modül geliştirme becerileri
Bu teklifin dayandığı bir diğer önemli varsayımlar kümesi şöyledir:
 * Şablon ve modül geliştirme becerileri önemsiz değildir. Hem şablonlar hem de modüller çok fazla belirsiz özelliğe sahiptir.
 * Sitelerin en dikkate değer özelliklerinin birçoğu şablon ve modül olarak uygulansa da, bu beceriler genellikle fark edilmez, takdir edilmez ve kabul edilir.
 * Bu becerilere sahip onlarca kişi var ve birçok viki düzenliyorlar. Genellikle ana vikilerine odaklanırlar ve diğer vikilerden veya diğer dillerden katkıda bulunanlarla nispeten nadiren iletişim kurarlar. Temel teknoloji her yerde aynı olsa da, küresel MediaWiki çekirdek ve uzantı geliştiricileri topluluğuyla karşılaştırılabilecek gerçek bir küresel şablon geliştiricileri topluluğu yoktur. Belirli şablonlarda çapraz wiki işbirliği vakaları vardır, ancak bunlar tutarsızdır.
 * Bu becerilere sahip olan editörlerin bulunmadığı birçok vikiler de vardır. Nasıl çalıştıklarını tam olarak anlamadan ve etkili bir şekilde yerelleştirme ve bakım yapma yeteneği olmadan başka vikilerden şablonlar ve modüller kopyalarlar veya hiç şablon kullanmazlar.

Bu durum optimal olmaktan uzaktır. Şablon ve modül geliştiricilerinin becerileri daha fazla takdir gerektirir. Gerçekten ihtiyaç duyulan özellikler geliştirirler ve editör topluluklarına yerleştirilirler. Birçok dilde vikilerde, şablon geliştiriciler yapılandırılmış içerik, veri sunumu ve modülerleştirme için yenilikçi özellikler ortaya koyar. Bu yenilikler birçok vikide yararlı olabilir, ancak şu anda bunu başarmak için uygun bir mekanizma bulunmamaktadır.

Ve elbette, bu sorunlara yönelik herhangi bir çözüm, şablon sahiplerinin edindiği uzun yıllara dayanan uygulamalı deneyimleri atacak tamamen yeni teknolojiler üretmemelidir. Bu nedenle, şablon ve modül geliştirmek için sözdiziminde mümkün olduğunca az değişiklik yapılmalıdır. Değişmesi gereken şeyler, vikilere dağıtıldıkları ve yayıldıkları ve içindeki insan tarafından okunabilen dizilerin yerelleştirildiği (çevrildiği) yollardır.

Önerilen çözüm: Özet
MediaWiki'nin vikiler genelinde global olan birçok özelliği var: resimler (Commons kullanarak), engelleme, kullanıcı hesapları (CentralAuth), tercihler, kullanıcı sayfaları, kullanıcı JS ve CSS sayfaları ve diğerleri.

Şablonları ve modülleri de küresel bir depoda saklamak ve uzantılarla olduğu kadar sağlam bir şekilde yerelleştirmek mümkün olmalıdır.

Küresel şablonlar ve modüller, şablonların kodunu geliştirmede daha kolay işbirliği yapmalarını sağlayarak tüm vikilerde şablon koruyucuyu güçlendirir.

Küresel şablonlar ve modüller, çevirmenleri ve yerelleştiricileri, koddaki dizeleri aramak zorunda kalmadan yalnızca kullanıcı arabirimi dizelerini (“mesajlar”) çevirmeye odaklanmalarına izin vererek ve çeviri için aynı becerileri ve araçları kullanmalarına izin vererek güçlendirir. şablonları ve MediaWiki uzantıları.

Küresel şablonlar ve modüller, tüm wikilerdeki içerik editörlerini, bu şablonları kullanan içeriği, farklılıklara dalmak zorunda kalmadan ve her vikide farklı kural ve becerileri yeniden öğrenmek zorunda kalmadan yazma ve çevirme konusunda güçlendirecektir.

Şablon ve modül geliştirme sözdizimi ve genel şablon bakım ve dağıtım döngüsü değişmeyecektir, bu nedenle şablon koruyucusunun yıllar boyunca edindiği tüm beceriler alakalı olacaktır.

All wikis will be able to use the global templates, but not forced to do this. Communities will keep their capability to override any global functionality, design, workflows, and data.

Localizing templates will be as convenient as localizing MediaWiki extensions.

Templates must be able to be semantic and global
Semantic means that other software components, especially Visual Editor and Content Translation, must have a general way to understand that a template exists and that it provides certain functionality, so that it will be possible to insert it into a page as an infobox, a citation, a maintenance tag, etc., and not only as a generic template. Currently, the closest thing there is to making templates semantic is TemplateData, but it only describes the template’s parameters. It doesn’t, for example, help Visual Editor add an “Insert infobox” button to the toolbar.

Global means that a template’s code must be maintained in one place and usable in all wikis.

Making templates semantic
Templates have never been robustly semantic, in the sense of being easy to handle by software that processes pages.

There are only a few examples of templates that were made semantic:


 * Various reference templates, which are usable from the Visual Editor toolbar “” button. They require writing a lot of separate code to configure Citoid on each wiki that wants to use them.
 * “Citation needed”, which was adapted to Visual Editor in late 2019. It also requires configuration on each wiki. For example: English, Hebrew, Slovene. As of this writing, French, Spanish, and most other languages are not configured for this, even though they have templates of this kind.
 * Templates for mentioning users in the Flow extension, which require local configuration, too.
 * Some dump processing and research tools can parse English Wikipedia’s WikiProject page assessment templates, which are usually added to talk pages.
 * The GrowthExperiments extension suggests editors to perform certain tasks in articles based on the templates that are transcluded in them. The template names have to be configured manually by writing JSON files separately in each wiki. For example: Czech, Vietnamese, Korean, Arabic.
 * The PageTriage extension is configured to work with English Wikipedia’s hatnote templates (also known as “tags”).

In the case of PageTriage, the extension essentially hard-codes a single wiki’s templates, making it unusable in other wikis without a significant rewrite. Even if the on-wiki configuration step is small, as it is with the Flow example, it still needs to be done. This doesn’t scale well for the 900 wikis that Wikimedia has, and the thousands that it will have in the future.

These things should be global by default, so that they will be immediately usable in at least a basic default configuration on all wikis at once by extensions, bots, dump analyzers, etc.

Storage and delivery
The global templates and modules can be stored in a central wiki (Meta, Commons, or a whole new wiki), and it can even be Gerrit or another repository.

The best solution is probably creating a new wiki that will store them, without getting mixed up with images, general community discussion, etc.

Using Gerrit as storage for templates and modules code is technically possible, but it would lose an important element of accessibility for template maintainers: editing a template in a wiki page is much easier and familiar to the vast majority of template maintainers than making Git commits and waiting for code review. Therefore, Gerrit probably shouldn’t become a way for storing the template and module code, at least not the primary one.

Global templates and modules must be stored in a common repository that can be edited by most wiki editors. Rules about blocking and special permissions should initially be similar to the rules in other wikis: everything should be open by default, and it must be possible to protect very common, sensitive, or frequently-vandalized templates. More detailed rules about protection levels can be developed by the editors community later.

How the templates are delivered to the target wikis is a question of internal engineering and architecture, as long as the other requirements are addressed. These questions were discussed in the past by some platform developers, for example around the Shadow namespaces project. This document tries to address related questions of how it works for the user who edits a page that uses a template, or who maintains the template itself—how to write it in a localizable way; how is it translated; how is it locally customized; etc. These questions weren’t addressed sufficiently in the previous architectural discussions on the topic.

Templates must remain easy to modify
An important feature of how templates currently work is that they are edited just like wiki pages and immediately become functional after publishing without review or deployment. This is somewhat dangerous because a bad edit can ruin many pages, but the fact is that it works mostly well.

This ease must be preserved. Community members who maintain templates will most likely reject moving to a new system that will require them to learn completely new skills and drag every change through an exhausting review and deployment phase. This probably means that storing the templates in Gerrit is not going to work, unless, perhaps, the process for review and deployment will be much easier than it is for extensions.

It must be possible to make some templates non-global
Not all templates should be forced to be global.

In fact, some templates should be local because they implement a functionality that is unique to a certain language. By their nature, such templates don’t need to be translated, and there should be a way to give a hint to both human editors and translation tools (such as Content Translation) that they don’t need to be adapted, and can be skipped or substituted. This is a part of the effort to make templates more semantic.

It must be possible to override some functionality or appearance of a global template
No community should feel that a functionality is imposed on it by some powerful external player, like the English Wikipedia community, the Wikidata community, the WMF, or anybody else. Global templates should be developed and used collaboratively for the common benefit. Most of the time it should work for everybody.

Sometimes some communities will have strong opinions about wanting to have particular functionality or design that will be different in their language or project, or to show an infobox with information that is different from what is shown in other projects, or not to show it at all. The capability to override things locally must be allowed from the start. (Or rather, it must not be taken away.)

A global template must be immediately usable in every wiki
Just like a global user page is immediately available in every wiki in which there is no local user page, every template or module that is created on the global infrastructure must be immediately usable in every wiki.

This must not require any extra steps, such as copying wiki pages, creating wrapper templates with a local name, administrator intervention, waiting for hours for caches to refresh, etc.

After the central version is updated, the updated version will be immediately shown everywhere. To prevent vandalism, the editors community will develop policies on permissions and protection levels.

If the user interface strings (also known as “messages”) were not translated, the template will nevertheless be usable and the strings will be shown in the fallback language. See the sections on localization for more details.

It must be possible to translate all user-facing strings
The user interface strings (messages) of core MediaWiki, extensions, and some external tools such as Pageviews are translated conveniently and robustly on translatewiki.net. This localization process is familiar to at least some editors in all languages.

It’s currently not possible to do the same with templates. Multilingual sites such as Commons and mediawiki.org have the “TNT” system for translating some templates, but it’s very complicated and cannot be reused for Wikipedia, Wikisource, etc.

Ideally, it should be possible to translate templates just like core and extensions, using a wiki with the Translate extension.

The translated string must become usable immediately after the translation is submitted using the Translate interface.

It can be possible to edit the user interface strings in raw wiki pages, but ideally they should be edited primarily through a dedicated translation interface.

Translators should be able to focus on translating nothing but text. Seeing any code around it makes it difficult for people who are not experienced with programming and JSON files to contribute easily. In addition, editing translations into languages that are written from right to left in raw text files is extremely inconvenient. The Translate extension already addresses all of these issues.

The template documentation pages must be translatable as well. It’s mostly enough to do it using the page translation feature of the Translate extension, but it may require some adaptations.

The language in which the strings are shown to the user
Templates are primarily used when they are integrated into content, so by default the translated messages must be shown in the wiki’s content language.

Some templates, however, are used as UI elements. Therefore, perhaps it makes sense to also allow showing the translated strings in the user language, when it’s different from the wiki content language. This may be particularly relevant for multilingual sites such as Commons, Wikidata, Meta, and mediawiki.org.

MediaWiki’s usual fallback language chains must be used when a translation is not available. For example, if a message is not translated into Quechua or Guarani, it will be shown in Spanish, if it’s not translated into Bashkir or Chuvash, it will be shown in Russian, and so on. The ultimate fallback language is English, so if this message is not translated into Spanish or Russian, it will be shown in English.

Message keys
Messages should be represented as keys, similarly to how it is done in MediaWiki core, extensions, and tools.

Writing translatable strings will probably be the largest change in the template development process that template maintainers will have to get used to. Hard-coded strings will have to be separated and moved to messages organized by key. It must be made as easy as possible not only for the translators, but also for the template maintainers. Otherwise, they won’t actually do it, and the feature will be effectively rejected.

To easily make keys globally unique, it’s probably OK to automatically include the global template name in the message key.

Transitioning tools
A tool should be developed that will help the transitioning of a template or a module to central storage. It can do the following steps:
 * 1) Export a template from a local wiki and import it into the global wiki.
 * 2) Export all the templates that are used by this template (cascading).
 * 3) Identify the human-readable strings, convert them to a list with keys, and replace them with keys in the template’s source code.
 * 4) Import the template’s documentation page and TemplateData.
 * 5) Import the necessary CSS pages.

In most cases, this automatic process probably cannot create a fully usable and robust template or module, but it can help begin the transitioning process.

Organizing messages
The Translate extension organizes messages by groups, also known as “projects”, which can be further organized by aggregate groups. For example, Article Placeholder, Score, and Poem are all groups that represent the corresponding MediaWiki extensions, and they are all included in the “Extensions used by Wikimedia - Advanced” aggregate group, along with many other extensions.

Projects that represent MediaWiki extensions are configured in YAML files in the translatewiki repository and shown in the Translate user interface in a project selector, also known as “message group selector”.

Since there are many more templates than extensions, some modifications may be needed in the way the Translate extension handles message groups to accommodate templates translation.

Each template should be a message group. Closely related templates should be grouped in an aggregate message group. They can be similar to the categories in which they are stored, and in fact, the categories may even be reused. Editing files in a Git repository to organize these message groups is probably not desirable, because it’s too complex and slow.

It would be nice to show group and template names as localized in the selector, but it’s also OK if they are shown in English. If it’s good enough for extension localizers, it’s good enough for template localizers, too.

Templates must be shown as message groups on the Translate extension’s Language statistics special page (Special:LanguageStats). This will help localizers find what templates need translation. This should be generally similar to all message groups, but there are some special considerations for templates:
 * There will be thousands of templates, so it will be nice if the table’s design corresponds to this somehow.
 * The table should show on how many pages is each template transcluded and make it possible to order the rows by this number, to help localizers prioritize what is more important to translate.

Finding how to translate a template
Every template description page needs to have a direct link to translating it to the user’s language.

Some templates use Wikidata labels as part of their UI instead of hard-coding strings. This is done at the moment in Wikidata Infobox on Commons, Infotaula persona (Infobox person) in the Catalan Wikipedia, and in several other templates. These labels and values can be localized in Wikidata itself. Such usage cannot cover all the needs of template localization, but it is legitimate and useful for particular purposes. As long as this is properly described in the template documentation, this can continue to be used, and probably doesn’t need special infrastructure adaptations. (Perhaps the translation of the relevant labels and values can be somehow integrated into the Translate interface for localizing the template, but this is optional.)

Message parameters and magic words
In core MediaWiki and extensions, many messages have parameters, sometimes also known as “placeholders”. They are named $1, $2, etc., and they are filled in run time. Parameters are particularly important for making messages robustly translatable because different languages have different word order.

Something like this is needed in templates, too, although it is possible that the form does not have to be $1, $2, but template-like parameters with triple curly braces ( { – } ). This is to be decided according to considerations of parsing and localization convenience.

The magic words PLURAL, GENDER, and GRAMMAR must be supported in template messages as in MediaWiki messages.

Message documentation
In core MediaWiki and extensions, every translatable message is documented for the convenience of developers and translators. The documentation may include information about where the message appears, what the $1, $2, etc. parameters are, whether the word is a verb or an adjective, etc. This documentation is stored as pseudo-language with the code qqq.

Such documentation will be useful for template translation, too. How it is stored is a question of technical architecture. Perhaps it can be combined with TemplateData, perhaps it can be stored as a qqq language, and perhaps it can be something else.

Source language
Templates will be imported to the global storage not only from English-language projects, but from wikis in many languages. More than ever, the localization tools must support translation from any language and not only from English.

Fuzzying
In core MediaWiki and extensions and in translatable pages, if the source message in English changes, the message is automatically marked as outdated or “fuzzy”. The existing translations continue to work, but are shown to translators as needing an update. (The translation manager can also mark a message as not needing fuzzying.)

A similar mechanism will be needed for template localization. However, since it would be nice not to force English as the source language, there should be more ways to mark messages as fuzzy.

Localization considerations for modules
Lua modules can load and parse translatable MediaWiki strings, but there is no defined way for storing these strings for Lua modules that are maintained as wiki pages. It is possible to package Lua modules as parts of extensions, and then they are able to load messages from the extensions’ i18/*.json files, but this is done in very few extensions at the moment. Rewriting templates in Lua may be a more robust solution from the engineering point of view, but Lua will not necessarily be embraced by all existing template maintainers, and their cooperation will be crucial to the project’s success, so this cannot be done to all templates.

Some very internal, technical modules that are commonly used, rarely changed, and don’t require internationalization can probably be painlessly moved into the Scribunto extension itself. Some examples are No globals and Arguments.

Localizing the template name
The template may have a different name in every language, but it must be directly connected to the central storage.

Global templates and modules are supposed to be immediately usable in all wikis without any extra steps, so it must be possible to transclude a global template in a local wiki page using its global name. The cross-wiki editors community shall decide what will be the policy for these global names.

Similarly to parameter names, templates may have different names in different languages, and this must be preserved. There must be a structured way to translate template names. Perhaps Wikidata sitelinks can play a role, but not necessarily.

If this is not done, editors will either avoid global templates, or wrap the global template in a local template with a translated name, and this will probably cause the template to lose the connection to the global entity. This is not desirable and misses the whole point of the project.

Template names must only be translated to languages that can be content languages of wikis. Translation to Formal German or British English are probably unnecessary. There may be a way to have aliases or redirects. Language variants, for example for Serbian and Chinese, must be supported according to these languages’ needs.

If a local template exists in a wiki and it has the same name as a localized name of a global template, the local template will be used. This is similar to how local files with identical names override global files on Commons, and how local messages in the MediaWiki space override the localization coming from the code.

Lua module names are often localized, too. Their names can be localized for direct invoking from wiki pages, but since code usually uses English-like identifiers, the internal global names should probably be preferred for use in the code itself, for example in  statements.

Localizing parameter names
Parameter names are different in every language. They are usually based on words in each language, so it’s important for editing the transclusion in wiki syntax conveniently.

Ideally, the global template should have generic internal parameter names that have translations to different languages. This is somewhat similar to Wikidata property name labels, but it can be simpler: since English is a lingua franca for software developers and templates are a kind of software, it’s probably OK to have English as the default source language rather than generic numbers as it is in Wikidata.

These generic parameter names will be the common default names. They will work in wikis in all languages. The localized names will work in the wikis that has that language as its content language.

These translations of parameter names must be validated:


 * they must not include invalid characters
 * they must not be repeated within one template in one language
 * Anything else?

The actual process of translating the parameter names may be different from translating user interface strings. These names have technical constraints, and they must remain stable because changing a name of parameter will break existing transclusions, so there should be some safeguards against this.

Automatic parameter translation
If all the localized template and parameter names are stored centrally, it will possible to have a simple service that gets a valid template call with parameters, a source language name, and a target language name, and outputs a localized template call. For example:

Input:

Output:

In Content Translation this will be the primary way to adapt templates. Unlike the current template adaptation in Content Translation, this will be precise and complete, rather than based on guesses.

In visual editing and in 2017-style wiki syntax editing, simply copying and pasting a template from wiki in another language will do the parameter translation automatically.

For plain wiki syntax editing, there should be a simple way to operate this service, for example a special page or a dialog box where an editor can paste the template and the source language, and get the template with translated parameters.

In both cases only the names of the template and the parameters will be translated. Translating the parameter values is discussed separately.

Nameless parameters
Nameless numbered parameters must continue working, of course.

A decision is needed about how will their names be localized.

Translating parameter values
In addition to making the templates’ functionality and design shared, some thought must be given to making the template parameter values shared, as well as not shared.

Some parameter values are the same in all languages by their nature. Some examples include an IPA pronunciation of a place’s native name (e.g. [dɛn ˈɦaːx] for The Hague), the year of foundation of a city, the chemical formula of a compound, etc. At least some of these should probably be stored in Wikidata and easily loadable in a template.

Some parameter values have to be translated or transliterated, for example people’s names, translations of country mottos, etc.

Global templates must make this possible, but in practice, these things are still often copied across wikis, and this must be taken into account as well.

Some parameter values can be reliably and predictably converted automatically, and the global templates infrastructure must support this. For example, number formats and digit characters are often different in Burmese, in languages of India, and in some other languages, but they can be reliably converted using simple software.

Valid and functional parameter values must be usable in multiple languages and must not be language-specific. For example, using “yes” and “no” as boolean values is too English-centric. This probably doesn’t require changes in the infrastructure, but mostly an agreement in the cross-wiki template development community on good practices for adaptation to all languages.

Text direction
Templates must adapt themselves to the text direction (ltr / rtl) of the wiki in which they are displayed.

It must be convenient to write a template in a direction-neutral way, with as little explicit right and left alignment as possible.

Bots
Many templates in many wikis are regularly edited by bots. This capability must be preserved.

This is not supposed to require any changes in the software infrastructure, but it is mentioned here for completeness because it’s an important use case.

Transitioning the templates from the large wikis to central storage
 וּמֵעֵבֶר לְשׁוּרַת הַבְּרוֹשִׁים עָבְרָה הָרַכֶּבֶת אֲבָל אֲנַחְנוּ רַק שָׁמַעְנוּ אוֹתָהּ, וְלֹא רָאִינוּ. וְכָל הַדְּבָרִים שֶׁדִּבָּרְנוּ בֵּינֵינוּ הִתְחִילוּ בַּמִּלִּים, „אֲבָל אֲנַחְנוּ”. —יהודה עמיחי The most popular source language for translation in Content Translation is English, by far. After it come Spanish, Russian, French, German, Catalan, Ukrainian, Italian, Chinese, and Portuguese. Because of this, it makes sense that the common templates in the editions of Wikipedia in these most common languages, especially those in English, are the ones that are the most important to make global for the benefit of all other languages.

Somewhat paradoxically, however, the editors in these largest languages are also the least interested in making them global:


 * The templates already work well for them and most people there don’t directly care about the convenience of translation to other languages.
 * Rewriting the templates so that the strings will be translatable may be time-consuming and may force them to learn some new template maintenance skills.
 * Making the templates suddenly used by many more projects may make it harder to achieve consensus about making future changes in how the templates work.
 * Editors from different major wikis will have to work on reaching consensus about merging some templates with similar functionality that already exist on their sites.

This is more of a consideration of practicality and community relations than a consideration of engineering, but it must be taken into account when making technical architectural decisions. Without doing proper preparation in this area, the whole project will fail.

As long as there are important common templates that are not global, Content Translation and other software that handles templates from different wikis in any way, will have to keep supporting them. If the infrastructure for global templates is created, and migration of existing templates proceeds in a good pace, developers may consider stopping developing and some day deprecating the code for non-global template adaptation.

The pace of migrating templates from large wikis to the central repository can be one of the success metrics for the project.

It must be possible to use templates completely in both wiki syntax and in visual editing
It’s obvious, but should be mentioned anyway: Wiki syntax editing is not going away soon, and it must be possible to keep editing template transclusions in pages as it is done now. This must not become more complicated.

However, Visual Editor is increasingly embraced by both experienced and new editors, so every feature of how templates work must work well in both visual and wiki syntax editing.

Other features related to templates
There are some features that deal with templates in core MediaWiki and its extensions. All of them must continue working, and may need updating for the global templates age.

Core MediaWiki
There should be on-wiki tools for showing at least basic analysis of templates’ and modules’ usage on pages: the number of transclusions and invocations grouped by wiki, and lists of pages that use the templates and the modules. The feature that shows which templates does a page transclude while it’s being edited must continue working with global templates.

The What links here page must keep working, and remain useful for global transclusions.

TemplateData

 * It is possible to translate template and parameter descriptions in TemplateData, and the translations are displayed in the user interface language in Visual Editor’s template insertion dialog. This is good and must be preserved. The translation interface could possibly be improved, but the beginning is good. Adding support for TemplateData in the Translate extension can be a solution for this, but there can also be other solutions.
 * Wikitext format parameter (inline, block, custom) must keep working. It must also be possible to customize them per wiki—some wikis may prefer to see a certain template written in wiki syntax as one line, and some may prefer multiple lines.

Citoid

 * Citoid has to be configured on every wiki separately using JSON files, such as Citoid-template-type-map.json. In the global templates age, it must become possible to share these files, so that the “” button would be available in all wikis and work identically everywhere by default. As with templates, there must be a way to override this default in each wiki where the community wants different behavior.

TemplateStyles

 * There must be a possibility to write Template Styles pages in the same central repository as templates. The central style must be loaded by default, and it must be possible to override it locally.

TemplateSandbox

 * Special:TemplateSandbox must keep working.
 * It must be possible to edit a template in the central repository and preview it in a page in the target wiki.

TemplateWizard

 * The current system uses a wiki’s standard search to find templates. The results are presented in a list that might need to be changed to make the global or local status visible.
 * TemplateWizard gets its information for templates from the TemplateData API, so as long as that keeps returning the same structure there shouldn’t be any issues, and i18n is already working.

Wikibase

 * Wikidata can be used to bring in some parameter values from a central repository to the wiki. This is used productively in Wikipedia in several languages, among them French, Hebrew, Basque, Russian, Catalan, Estonian, and some others, as well as in Commons, although the actual implementation may differ. This must continue working, of course. Unifying the way in which it is done across different wikis may become one of this project’s most significant impact areas.
 * It may also make it much easier to implement Wikidata Bridge, the project to allow editing template values from within wikis. The modifications to the templates themselves will have to be done only once in the global templates, and not in each wiki.

VisualEditor

 * VisualEditor obviously needs to be able to insert both global and local templates.
 * VisualEditor shows a link to the template description page in the template editing dialog. This link should point directly to the global template when it is used.

Development and deployment
 Quam multa fieri non posse prius quam sunt facta iudicantur —C. Plinius Secundus Developing the infrastructure for global templates and modules is a large and complex project. It must be divided into manageable parts to get done. Roughly, the multiple parts of this project should be developed in the following sequence:


 * 1) Translatable modules: Before making the modules shareable across wikis, the internationalization and localization framework for them should be developed. This will be immediately useful to modules on wikis that are already multilingual, most notably Commons and Wikidata. Some of them are currently translated using the “TNT” system, but this could be better.
 * 2) Global modules: Modules become shareable across wikis. This should happen before making templates shareable, because the modules’ infrastructure is less coupled to core MediaWiki, and they will be easier to migrate.
 * 3) Translatable templates: This is similar to Translatable modules above, and can reuse much of the same framework, but it will also need the capability to translate the names of the template itself and its parameters and some other features. See the sections on localization in the specification.
 * 4) Global templates: Complete the project with making the templates global.

The development of more advanced features, such as making templates semantic can and should come later, after they are shareable. If they become semantic before they are shareable, the code that describes them semantically will be forked on different wikis, like the templates themselves, which will make code reuse even harder than it is today.

Access to global templates and modules will be available from all the Wikimedia wikis. This includes editions of Wikipedia, Wiktionary, Wikivoyage, etc. in all the languages, as well as Commons, Wikidata, Meta, mediawiki.org, Wikitech, etc., as well as test wikis (test.wikipedia.org, etc.) This is similar to how images on Commons are available on all the wikis. Even though the global templates and modules will be available to the wikis, the wikis won’t be obliged to use them.

Making templates easily reusable on non-Wikimedia projects may be desirable, too. Even though it doesn’t directly benefit Wikimedia projects, it may make sense to consider making templates easily reusable not only across Wikimedia projects, but also on other MediaWiki sites. Doing this will probably require some more work, but it may contribute to better modularization, and this may eventually benefit Wikimedia projects, too. This is comparable to the capability of direct embedding of images from Commons on non-Wikimedia websites.

Imagine a world
Imagine a world in which every single human being can freely share in the sum of all knowledge and it’s actually a really easy thing to do because templates are global:

(Note: The “With global templates” column assumes that the infrastructure is deployed in all Wikimedia wikis, and that the most often used templates are moved to the central infrastructure.)

Status
 А мы всё молчим, Мы всё считаем и ждём; Мы всё поём о себе, О чём же нам петь ещё? —Борис Гребенщиков

As noted above, as of October 2019, this page is only an idea, and not a commitment to implement a project.

Similar ideas were suggested in the past. The oldest known suggestion to make templates reusable across wikis was raised in December 2004 in Bugzilla: Interwiki templates. Several other similar ideas were raised later, for example Phabricator. In February 2017 a similar proposal called Global-Wiki was closed as "consensus". Some of its components were implemented, such as global preferences, but not the templates.

The wish "Central global repository for templates, gadgets and Lua modules" was voted #3 at the Community Wishlist Survey 2015 and "Global gadgets" was voted #1 in Community Wishlist Survey 2016. Despite the community support, neither was implemented, because they weren’t appropriate for the Community Tech team, and they weren’t transferred to another team either.

The Platform Evolution project (2018) indicated some intentions to have support for global templates in the future. The page Platform Evolution/Recommendations discusses ideas for updating content modularity, and says:


 * ... “boxes” are an ideal focus area for creating modularity. They represent self contained features and also an opportunity to enable equitable sharing of user features across projects and languages be establishing a cross-project service to share templates. This project will also force us to consider how to handle content layout and structure separately from composable pieces content.

The closely related page Platform Evolution/Goals lists this as one of the goals:


 * Increase equity and power of contribution tools. We want to support the contribution of more content types of content, including media, in more interactive ways and across all projects. This means making some existing tools - like templates - available for consistent reuse across all projects and languages. It also means improving translation tools to remove silos of content. Finally, we also want to make it easy for contributors to create new cross-project, localizable content tools.

Other than these goals, however, there is no detailed plan for how such a feature will work. This page is an attempt to propose such a plan and listen to feedback from editors.

Useful links
Some relevant pages that discuss similar topics:


 * Platform Evolution/Goals
 * Platform Evolution/Recommendations
 * Multilingual Templates and Modules - An attempt to implement a similar feature using bots
 * meta:Community Wishlist Survey 2015/Results - Central Global Repository for Templates, Lua modules, and Gadgets came in as #3 in the Community Wishlist vote. Listed as “In development - Parsing team”, but not actually done.
 * meta:Which templates should be global? - an informal list made by various editors
 * Requests for comment/Shadow namespaces - a dormant RFC about one proposal for a technical implementation of such an infrastructure
 * - an existing rudimentary mechanism for transcluding content across projects. Considered inefficient and insecure, and disabled on Wikimedia projects.
 * meta:Global-Wiki - a similar proposal, with a wider scope. Was open for discussion for several years, and closed as "consensus". Some things in it were implemented, such as global user pages and preferences, but it also includes global templates, which are not yet done.