לדלג לתוכן
תפריט ראשי
תפריט ראשי
העברה לסרגל הצד
הסתרה
ניווט
עמוד ראשי
ברוכים הבאים
שינויים אחרונים
פורטלים
ערך אקראי
צור קשר/תרומה
קהילה
עזרה
ייעוץ
אולם דיונים
לוח מודעות
ספר אורחים
חב"דפדיה
חיפוש
חיפוש
מראה
יצירת חשבון
כניסה לחשבון
כלים אישיים
יצירת חשבון
כניסה לחשבון
דפים לעורכים שלא נכנסו לחשבון
מידע נוסף
תרומות
שיחה
עריכת הדף "
יחידה:תרגום יחידה
"
יחידה
שיחה
English
קריאה
עריכת קוד מקור
גרסאות קודמות
כלים
כלים
העברה לסרגל הצד
הסתרה
פעולות
קריאה
עריכת קוד מקור
גרסאות קודמות
כללי
דפים המקושרים לכאן
שינויים בדפים המקושרים
דפים מיוחדים
מידע על הדף
מראה
העברה לסרגל הצד
הסתרה
אזהרה:
אינכם מחוברים לחשבון. כתובת ה־IP שלכם תוצג בפומבי אם תבצעו עריכות כלשהן. אם
תיכנסו לחשבון
או
תיצרו חשבון
, העריכות שלכם תיוחסנה לשם המשתמש שלכם ותקבלו גם יתרונות אחרים.
בדיקת אנטי־ספאם.
אין
למלא שדה זה!
--[=[ provide translation of parameter names to names expected by other modules. so imported modules can be used with local language names, without having to be modified, or at least minimizing local modifications, which is friendly to keeping up to date with upstream, and usually "safer". to use it with specific module, or rather, specific function, a translation table has to be built. this is done via utility "data" module (same utility module can serve several related functions, when parameter names and their translations coincide). when appropriate, this module should be easily mapped to the original module, typically as a subpage with standard name, e.g., /he. the utility translation module looks like so: return { ["simple"] = { ['translated parameter name'] = 'original parameter name', and so on and so forth } ["running"] = { ['running translated parameter name'] = 'running original parameter name', } } "running" is for parameters of the form "title1", "title2" etc., like used, e.g., in [[:en:Template:Track listing]]. to translate all those to "שם1", "שם2", "שם3", we'll have in the translation module return { ["simple"] = { ['translated parameter name'] = 'original parameter name', and so on and so forth } ["running"] = { ['שם'] = 'title', } } to use it, replace {{#invoke:some module|some function|params...}} with {{#invoke:תרגום יחידה| call | module = some module | func = some function | translation = name of translation module...}} if you copy this module to a differnet wiki into module:a_different__name then replace "תרגום יחידה" above with a_different_name the parameters in invocation are passed alongside the translated ones, and this module can be used without breaking existing templates (which use original parameter names) templates converted to use it should define in templatedata the translated names as parameters, each with the original parameter as its alias. (recommended everywhere and mandatory on hewiki, which uses templatedata for Module:ParamValidator) ]=] local function translate_args(args, trans_table) local ret = {} for param, value in pairs(args or {}) do ret[param] = value if trans_table.simple and trans_table.simple[param] then ret[ trans_table.simple[param] ] = value end for pattern, trans in pairs(trans_table['running'] or {}) do rtrans, rep = mw.ustring.gsub(param, pattern .. "(%d+)", function(d) return trans .. d end, 1 ) if rep == 1 then ret[rtrans] = value end end end return ret end local function module_translate(frame) -- frame uses a metatable which makes "args" immutable. -- replace params with enriched clone, and override getParent to return parent_clone local trans_table = mw.loadData('Module:' .. frame.args['translation']) local parent = frame:getParent() frame.getParent = function() return parent end frame.args = translate_args(frame.args, trans_table) parent.args = translate_args(parent.args, trans_table) -- call target function with translator-enriched frame. local target_module = require('Module:' .. frame.args['module']) local target_func = target_module[frame.args['func']] return target_func(frame) end return { ['קרא ל'] = module_translate, ['call']= module_translate, }
תקציר
?
לתשומת ליבך: תרומתך לאתר חב"דפדיה תפורסם לפי תנאי הרישיון GNU Free Documentation License 1.2 (אפשר לעיין בדף
חב"דפדיה:זכויות יוצרים
לפרטים נוספים). אם אינך רוצה שעבודתך תהיה זמינה לעריכה על־ידי אחרים, שתופץ לעיני כול, ושאחרים יוכלו להעתיק ממנה תוך ציון המקור – אין לפרסם אותה פה.
כמו־כן, שמירת העריכה משמעה הבטחה שכתבת את הטקסט הזה בעצמך או העתקת אותו ממקור בנחלת הכלל (שאינו מוגבל בזכויות יוצרים) או מקור חופשי דומה.
אין לשלוח חומר מוגבל בזכויות יוצרים ללא רשות!
ביטול
עזרה בעריכה
(נפתח בחלון חדש)
הדף הבא מוכלל בדף זה:
יחידה:תרגום יחידה/תיעוד
(
עריכה
)