exists() ? $user->display_name : ''; $format = current_theme_supports('html5', 'comment-form') ? 'html5' : 'xhtml'; $format = apply_filters('fansub_comment_form_format', $format); $req = get_option('require_name_email'); $aria_req = ($req ? " aria-required='true'" : ''); $html_req = ($req ? " required='required'" : ''); $required_text = sprintf(' ' . __('Những mục bắt buộc được đánh dấu %s', 'fansub'), '*'); $html5 = 'html5' === $format; $defaults = array( 'comment_field' => '
', 'must_log_in' => '
' . sprintf(__('Bạn phải đăng nhập trước khi có thể đăng bình luận.', 'fansub'), wp_login_url(apply_filters('the_permalink', get_permalink(get_the_ID())))) . '
', 'logged_in_as' => '' . sprintf(__('Bạn đang đăng nhập với tài khoản %2$s. Thoát?', 'fansub'), get_edit_user_link(), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink(get_the_ID())))) . '
', 'comment_notes_before' => '' . __('Địa chỉ email của bạn sẽ được giữ bí mật.', 'fansub') . ''. ($req ? $required_text : '') . '
', 'title_reply' => '' . __('Gửi bình luận', 'fansub') . '', 'title_reply_to' => __('Gửi trả lời cho %s', 'fansub'), 'cancel_reply_link' => __('Nhấn vào đây để hủy trả lời.', 'fansub'), 'label_submit' => __('Gửi bình luận', 'fansub') ); return $defaults; } add_filter('comment_form_defaults', 'fansub_theme_translation_comment_form_defaults'); function fansub_theme_translation_comments_list_callback($comment, $args, $depth) { $GLOBALS['comment'] = $comment; $comment_id = $comment->comment_ID; $style = isset($args['style']) ? $args['style'] : 'ol'; $avatar_size = isset($args['avatar_size']) ? absint($args['avatar_size']) : 64; $max_depth = isset($args['max_depth']) ? absint($args['max_depth']) : ''; $comment_permalink = get_comment_link($comment); if('div' == $style) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = 'div-comment'; } $comment_date = get_comment_date('Y-m-d H:i:s', $comment_id); $comment_author = ' '; $comment_metadata = ' '; if($comment->comment_approved == '0') { $comment_metadata .= '' . __('Bình luận của bạn đang được chờ để xét duyệt.', 'fansub') . '
'; } $footer = new FANSUB_HTML('footer'); $footer->set_class('comment-meta'); $footer->set_text($comment_author . $comment_metadata); $comment_text = get_comment_text($comment_id); $comment_text = apply_filters('comment_text', $comment_text, $comment); $comment_content = '' . '
', 'url' => '' . '
', ); return $fields; } add_filter('comment_form_default_fields', 'fansub_theme_translation_comment_form_default_fields'); function fansub_theme_translation_wp_list_comments_args($args) { $args['reply_text'] = '' . __('Trả lời', 'fansub') . ''; $args['callback'] = 'fansub_theme_translation_comments_list_callback'; return $args; } add_filter('wp_list_comments_args', 'fansub_theme_translation_wp_list_comments_args', 10); function fansub_theme_translation_gettext($translation, $text) { switch($text) { case 'Nothing Found': $translation = 'Không tìm thấy nội dung'; break; case 'Ready to publish your first post? Get started here.': $translation = 'Bạn đã sẵn sàng viết bài? Bắt đầu từ đây.'; break; case 'Sorry, but nothing matched your search terms. Please try again with some different keywords.': $translation = 'Xin lỗi, nhưng hệ thống không tìm thấy nội dung bạn đang tìm kiếm, có thể thử lại bằng cách dùng từ khóa khác.'; break; case 'It seems we can’t find what you’re looking for. Perhaps searching can help.': $translation = 'Hệ thống không tìm thấy nội dung bạn đang muốn xem. Bạn có thể thử dùng công cụ tìm kiếm để trợ giúp.'; break; case 'It looks like nothing was found at this location. Maybe try a search?': $translation = 'Dường như không có gì được tìm thấy trong đường dẫn này. Bạn có thể thử công cụ tìm kiếm?'; break; case 'Oops! That page can’t be found.': $translation = 'Xin lỗi! Trang này không được tìm thấy'; break; } return $translation; } add_filter('gettext', 'fansub_theme_translation_gettext', 10, 2); function fansub_theme_translation_gettext_with_context($translations, $text, $context, $domain = 'default') { switch($text) { case 'Search for:': $translations = 'Tìm kiếm cho:'; break; case 'Search …': $translations = 'Từ khóa…'; break; case 'Search': $translations = 'Tìm kiếm'; break; } return $translations; } add_filter('gettext_with_context', 'fansub_theme_translation_gettext_with_context', 10, 3); function fansub_theme_translation_ngettext($translation, $single, $plural, $number, $domain = 'default') { $translations = get_translations_for_domain($domain); $translation = $translations->translate_plural($single, $plural, $number); switch($translation) { case '%s second': case '%s seconds': $translation = '%s giây'; break; case '%s min': case '%s mins': case '%s minute': case '%s minutes': $translation = '%s phút'; break; case '%s hour': case '%s hours': $translation = '%s giờ'; break; case '%s day': case '%s days': $translation = '%s ngày'; break; case '%s week': case '%s weeks': $translation = '%s tuần'; break; case '%s month': case '%s months': $translation = '%s tháng'; break; case '%s year': case '%s years': $translation = '%s năm'; break; } return $translation; } add_filter('ngettext', 'fansub_theme_translation_ngettext', 10, 4); function fansub_theme_translation_comment_list_class($classes) { $classes[] = 'custom'; return $classes; } add_filter('fansub_comment_list_class', 'fansub_theme_translation_comment_list_class');