Translatable modules/Proposed solutions/ja

 翻訳対象モジュールプロジェクトでは、モジュールのローカル化に用いる新しいフレームワークを構築しようとしています.

ストレージに関する解決策を集め、複数の案をここで協議するよう提案しています.

'''この聞き取り調査の主な目的の一つとして、これら解決策からどれを実装し、モジュール開発者の皆さんに推奨するか決めることにあります. '''



説明
メタにあるModule:ModuleMsg on Meta に似ていて、もっと標準化したものを使用.


 * 通常のウィキ文で記述したページにあるメッセージ群は、すべて翻訳対象としてマークする.
 * 標準的な Lua 機能を読み込みに用いる (ウィキ単位で採用する Module:ModuleMsg などのモジュールは使わない. )

長所

 * 翻訳管理者は、ページを翻訳対象としてマークする作業に慣れている.
 * テンプレート群にも有用かもしれない.
 * 翻訳はすべてウィキページで発生. 権利関係、履歴、処理の別建てその他の面で有益.

短所

 * By default, translation unit markers are numbers. Using numbers as message keys makes code unreadable. It’s possible to replace the numbers with strings, but, as noted above, the way to do it in the Translate extension is not currently documented well. This can probably be addressed by proper documentation and standartization of this Translate extension feature.
 * It’s unclear how will parameters ($1, etc.) and other wiki syntax i18n features (GENDER, PLURAL, etc.) work. They are not necessarily compatible with wikitext content pages.
 * This may work for module localization within one wiki, but will not necessarily work when modules become global.
 * A solution will be needed for looking up pages for translation. Currently, the message group selector just shows all the translatable pages.
 * In the global modules and templates age, it’s unclear how will it be locally customized on wikis.
 * Possible performance issues if each message translation is loaded individually, and in handling of fallbacks. There is the  Action API but possibly no nice Lua or Wikitext API for loading the translations.

Description
Use something similar to what Module:TNT is doing, but formalized:


 * Store all the source messages in a JSON file in the Data namespace on Commons in the “banana” format, like in MediaWiki extensions, including qqq for documentation.
 * The same syntax can be used as for core and extension messages.
 * Enhance the Translate extension to load the source messages and write the translations to JSON files by language.
 * Add Lua functions to the standard Scribunto library to load the messages.
 * Use another JSON file to organize the translatable file for convenient display in Translate’s message group selector.

長所
An API might be needed to retrieve one single language or fallback, improving network access. JavaScript gadgets prefer one single query for all messages, stored at client cache.
 * The file format is the same as in extensions.
 * These pages are already globally accessible from modules.
 * The raw pages are easily available for JavaScript gadgets, which will convert JSON into native object, containing all translations if desired.

短所

 * A new file format support (FFS) will have to be developed and maintained in the Translate extension. We will need a new type of MessageGroup, as well as MessageLoading.
 * In the global modules and templates age, it’s unclear how it will be locally customized on wikis.

Description
Similar to “JSON .tab file in the Data namespace”, but:


 * Store all the source messages in a JSON file in the Data namespace on Commons in the “banana” format, like in MediaWiki extensions, including qqq for documentation.
 * (Need to decide whether to store all the languages in one JSON structure, or a slot per language.)
 * The JSON file is stored as an MCR slot with the wiki page that stores the module’s code.
 * The same syntax can be used as for core and extension messages.
 * Enhance the Translate extension to load the source messages and write the translations to JSON files by language.
 * Add Lua functions to the standard Scribunto library to load the messages.
 * Use another JSON file to organize the translatable file for convenient display in Translate’s message group selector.

長所

 * Stored elegantly with the module.
 * If the module becomes global, the data becomes global with it.
 * Creating MCR slots may require some privileges, but that’s probably OK because creating new messages files is not for total newbies anyway, while editing is still accessible to most editors.

短所

 * Will require some development to create slot support.
 * A new FFS will have to be developed and maintained in Translate. We will need a new type of MessageGroup, as well as MessageLoading.
 * In the global modules and templates age, it’s unclear how it will be locally customized on wikis.
 * Common disadvantage of MCR slot approach: Permissions and history mixed altogether. Code programming has the same protection level as translations, every translator is permitted to modify the effective code. There is no history of the effective changes in global programming, but drowning among translation edits. If protection and history would be separated, these are individual pages but not MCR.

Description
Similar to the JSON proposals above, but with the JSON stored inside TemplateData:


 * Store all the source messages as a JSON value in TemplateData associated with a template that uses the module. Other than being part of a larger JSON structure, the format is otherwise the same as “banana” format, like in MediaWiki extensions, including qqq for documentation.
 * The same syntax can be used as for core and extension messages.
 * Enhance the Translate extension to load the source messages and write the translations to JSON files by language.
 * Add Lua functions to the standard Scribunto library to load TemplateData and the messages.
 * Use another JSON file to organize the translatable file for convenient display in Translate’s message group selector.

長所

 * Continuity with existing TemplateData technology.
 * In particular, TemplateData already has some support for internationalization, e.g. template description can be in several languages.
 * Keys can be managed through the TemplateData editor (this will require updates to the editor UI, however).
 * The technology can be later shared with templates.
 * If TemplateData ever moves to MCR, it will move there, too.

短所

 * There is a hard-coded limit of 64 KiB (gzipped) in the TemplateData extension’s code. While this is enough room for something like 700 messages, we have about 400 languages to manage. When using the rate at which MediaWiki core messages are localized, there is room for only 20 messages.
 * Requires adding TemplateData support to Scribunto.
 * A new file format support (FFS) will have to be developed and maintained in Translate.
 * In the global modules and templates age, it’s unclear how it will be locally customized on wikis.

Description

 * Store the translatable messages in the MediaWiki namespace, like core and extension messages.
 * Create message groups for Translate using a JSON or YAML file stored as a wiki page. This is already supported (WikiMessageGroup) as whitespace separated lists, however, there is no mechanism exposed to define groups inside the wiki itself.

長所

 * Mostly natural for Translate to process (but support for the message group organizer will probably have to be developed).
 * Mostly natural for Scribunto to process—message loading parsing functions already exist.
 * Can be customized on local wikis when modules become global the same way that messages from core and extensions are customized.

短所

 * Double duty of listing messages as well as creating them separately.
 * Creating the messages will require sysop or edit-interface permissions, making comprehensive module development and bug fixing accessible to much fewer people.
 * Lack of packaging. Many distributed development teams will create and maintain packages of module, global template, accompanied by TemplateData, or JavaScript gadget, but should not conflict in naming between packages of similar targets. Should be bundled per package.

Description
Do it similarly to existing solutions in Module:I18n on Commons and Module:Wikidades/i18n on the Catalan Wikipedia, but:


 * Standardize the Lua table format: Decide whether it is one message key pointing to many translations indexed by language, or language codes pointing to many message keys, etc.
 * Add functions to the Scribunto standard library to load these messages.
 * Add support for reading and writing this file format to Translate.

長所

 * Natural for Lua.
 * Continuity with at least some existing solutions.

短所

 * This is actual code, which is error-prone and less safe. (We already used to have messages in PHP arrays, and moved away from it.)
 * It’s natural for Lua, but what if Scribunto acquires support for other programming languages? There are recurring requests to support JavaScript, Python, Rexx, etc.
 * Language codes that have hyphens have to be written with square brackets, which is non-obvious and error-prone.

= Proposed solutions comparison table =



関連情報

 * 協議の場はトークページ Talk:Translatable modulesで実施.