Server IP : 103.119.228.120 / Your IP : 18.221.93.167 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/ssl/local/share/perl5/Locale/Maketext/Utils/Phrase/Norm/ |
Upload File : |
package Locale::Maketext::Utils::Phrase::Norm::EndPunc; use strict; use warnings; sub normalize_maketext_string { my ($filter) = @_; my $string_sr = $filter->get_string_sr(); if ( ${$string_sr} !~ m/[\!\?\.\:\]…]$/ ) { # ? TODO ? smarter check that is is actual bracket notation and not just a string ? if ( !__is_title_case( ${$string_sr} ) ) { # ${$string_sr} = ${$string_sr} . "[comment,missing puncutation ?]"; $filter->add_warning('Non title/label does not end with some sort of punctuation or bracket notation.'); } } return $filter->return_value; } # this is a really, really, REALLY, *REALLY* dumb check (that is why this filter is a warning) sub __is_title_case { my ($string) = @_; my $word; # buffer my $possible_ick = 0; # this splits on the whitespace leftover after the Whitespace filter for $word ( split( /(?:\x20|\xc2\xa0)/, $string ) ) { next if !defined $word || $word eq ''; # e.g ' … X Y' next if $word =~ m/^[A-Z\[]/; # When would a title/label ever start life w/ a beginning ellipsis? i.e. ' … Address' instead of 'Email Address'. # If it is a short conclusion it should have puncutaion, e.g. 'Compiling …' ' … done.' next if length($word) < 3; # There are longer words that should be lowercase (hint: [asis] [comment]), there are shorter words that should be capitol: see “this is a …” above $possible_ick++; } return if $possible_ick; return 1; } 1; __END__ =encoding utf-8 =head1 Normalization We want to make sure phrases end correctly and consistently. =head2 Rationale Correct punctuation makes the meaning clearer to end users. Clearer meaning makes it easier to make a good translation. Consistent punctuation makes it easier for developers to work with. Consistent punctuation is a sign of higher quality product. Missing punctuation is a sign that partial phrases are in use or an error has been made. =head1 IF YOU USE THIS FILTER ALSO USE … … THIS FILTER L<Locale::Maketext::Utils::Phrase::Norm::Whitespace>. This is not enforced anywhere since we want to assume the coder knows what they are doing. =head1 possible violations None =head1 possible warnings =over 4 =item Non title/label does not end with some sort of punctuation or bracket notation. Problem should be self explanatory. Ending punctuation is not !, ?, ., :, bracket notation, or an ellipsis character. If it is legit you could address this by adding a [comment] to the end for clarity and to make it harder to use as a partial phrase. For some reason I must not end well[comment,no puncuation because …] If it is titlecase and it has word longer than 2 characters that must start with a lower case letter you have 2 options: =over 4 =item 1 use asis() Buy [asis,aCme™] Products =item 2 use comment() with a comment that does not have a space or a non-break space: People [comment,this-has-to-start-with-lowercase-because-…]for Love =back =back =head1 Entire filter only runs under extra filter mode. See L<Locale::Maketext::Utils::Phrase::Norm/extra filters> for more details.