Sửa đổi Mô đun:Citation
Chú ý: Bạn chưa đăng nhập và địa chỉ IP của bạn sẽ hiển thị công khai khi lưu các sửa đổi.
Bạn có thể tham gia như người biên soạn chuyên nghiệp và lâu dài ở Bách khoa Toàn thư Việt Nam, bằng cách đăng ký và đăng nhập - IP của bạn sẽ không bị công khai và có thêm nhiều lợi ích khác.
Các sửa đổi có thể được lùi lại. Xin hãy kiểm tra phần so sánh bên dưới để xác nhận lại những gì bạn muốn làm, sau đó lưu thay đổi ở dưới để hoàn tất việc lùi lại sửa đổi.
Bản hiện tại | Nội dung bạn nhập | ||
Dòng 19: | Dòng 19: | ||
local whitelist = {}; -- table of tables listing valid template parameter names; defined in Module:Citation/Whitelist | local whitelist = {}; -- table of tables listing valid template parameter names; defined in Module:Citation/Whitelist | ||
+ | --------------------- VIETNAMESE ----------------------- | ||
+ | |||
+ | ---Định dạng ngày tháng | ||
+ | local function vi_formatdate(rawDate, dayPrefix) | ||
+ | local formatStr = 'j F "năm" Y' | ||
+ | if dayPrefix then formatStr = '"ngày" ' .. formatStr end | ||
+ | -- Năm | ||
+ | if tonumber(rawDate) then | ||
+ | formatStr = 'Y' | ||
+ | -- Năm tháng | ||
+ | elseif mw.ustring.match(rawDate, "^[Tt]háng %d%d?,? %d%d%d%d$") or | ||
+ | mw.ustring.match(rawDate, "^[Tt]háng %d%d?,? năm %d%d%d%d$") or | ||
+ | mw.ustring.match(rawDate, "^[Tt]háng %a+,? năm %d%d%d%d$") or | ||
+ | mw.ustring.match(rawDate, "^%a+%.?,? %d%d%d%d$") or | ||
+ | mw.ustring.match(rawDate, "^%d%d%d%d%-%d%d$") then | ||
+ | rawDate = mw.ustring.gsub(rawDate, ",", "") | ||
+ | formatStr = 'F "năm" Y' | ||
+ | end | ||
+ | local good, formattedDate = pcall(contentLanguage.formatDate, contentLanguage, formatStr, rawDate) | ||
+ | if good then return formattedDate else return rawDate end | ||
+ | end | ||
+ | function z._vi_formatdate(frame) | ||
+ | return vi_formatdate(frame.args[1], frame.args[2]) | ||
+ | end | ||
+ | |||
+ | ---Cho ra tên tiếng Việt của ngôn ngữ có mã được đưa vào. Nếu một tên ngôn ngữ được đưa vào, tên đó được cho ra. | ||
+ | local function vi_formatlanguage(rawLanguage) | ||
+ | local languageName = mw.language.fetchLanguageName(rawLanguage, contentLanguage:getCode()) | ||
+ | if not languageName or #languageName < 1 then return rawLanguage end | ||
+ | return (mw.ustring.gsub(languageName, "^[Tt]iếng ", "tiếng ", 1)) | ||
+ | end | ||
+ | function z._vi_formatlanguage(frame) | ||
+ | return vi_formatlanguage(frame.args[1]) | ||
+ | end | ||
+ | |||
+ | ---Định dạng số ấn bản. | ||
+ | local function vi_formatedition(rawEdition) | ||
+ | if tonumber(rawEdition) then return rawEdition end | ||
+ | local num = mw.ustring.match(rawEdition, "(%d+)th") or | ||
+ | mw.ustring.match(rawEdition, "(%d+)st") or | ||
+ | mw.ustring.match(rawEdition, "(%d+)nd") or | ||
+ | mw.ustring.match(rawEdition, "(%d+)rd") | ||
+ | return num or "" | ||
+ | end | ||
+ | function z._vi_formatedition(frame) | ||
+ | return vi_formatedition(frame.args[1]) | ||
+ | end | ||
--[[--------------------------< P A G E S C O P E V A R I A B L E S >-------------------------------------- | --[[--------------------------< P A G E S C O P E V A R I A B L E S >-------------------------------------- | ||
Dòng 1.544: | Dòng 1.591: | ||
name, code = get_iso639_code (lang, cfg.this_wiki_code); -- attempt to get code from name (assign name here so that we are sure of proper capitalization) | name, code = get_iso639_code (lang, cfg.this_wiki_code); -- attempt to get code from name (assign name here so that we are sure of proper capitalization) | ||
end | end | ||
− | + | name = mw.ustring.gsub(name, "^[Tt]iếng ", "", 1) ------- Thêm cho tiếng Việt ------- | |
+ | |||
if is_set (code) then -- only 2- or 3-character codes | if is_set (code) then -- only 2- or 3-character codes | ||
name = cfg.lang_code_remap[code] or name; -- override wikimedia when they misuse language codes/names | name = cfg.lang_code_remap[code] or name; -- override wikimedia when they misuse language codes/names | ||
Dòng 3.312: | Dòng 3.360: | ||
if is_set (Translators) then | if is_set (Translators) then | ||
− | Others = safe_join ({sepc .. ' ', wrap_msg (' | + | Others = safe_join ({sepc .. ' ', wrap_msg ('phiên dịch', Translators, use_lowercase), Others}, sepc); |
end | end | ||
if is_set (Interviewers) then | if is_set (Interviewers) then | ||
− | Others = safe_join ({sepc .. ' ', wrap_msg (' | + | Others = safe_join ({sepc .. ' ', wrap_msg ('phỏng vấn', Interviewers, use_lowercase), Others}, sepc); |
end | end | ||
Dòng 3.412: | Dòng 3.460: | ||
local Lay = ''; | local Lay = ''; | ||
if is_set(LayURL) then | if is_set(LayURL) then | ||
− | if is_set(LayDate) then LayDate = " (" .. LayDate .. ")" end | + | if is_set(LayDate) then LayDate = " (" .. vi_formatdate(LayDate) .. ")" end |
if is_set(LaySource) then | if is_set(LaySource) then | ||
LaySource = " – ''" .. safe_for_italics(LaySource) .. "''"; | LaySource = " – ''" .. safe_for_italics(LaySource) .. "''"; | ||
Dòng 3.438: | Dòng 3.486: | ||
local Publisher; | local Publisher; | ||
if is_set(PublicationDate) then | if is_set(PublicationDate) then | ||
− | PublicationDate = wrap_msg (' | + | PublicationDate = wrap_msg ('xuất bản', PublicationDate); |
end | end | ||
if is_set(PublisherName) then | if is_set(PublisherName) then |