From 9cd3b17743b335407a663742998bbc0e93386f12 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 24 Jan 2018 16:51:32 -0500 Subject: [PATCH 1/4] Fix translation strings for use with util/extract.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change parentheses to “\x28” and “\x29” - Remove leading commas - Remove quotes before commas --- include/conversation.php | 6 +++--- include/enotify.php | 4 ++-- include/security.php | 2 +- mod/admin.php | 32 ++++++++++++++++---------------- mod/babel.php | 8 ++++---- mod/dfrn_request.php | 4 ++-- mod/editpost.php | 2 +- mod/install.php | 8 ++++---- mod/lostpass.php | 4 ++-- mod/photos.php | 4 ++-- mod/profiles.php | 2 +- mod/register.php | 2 +- mod/settings.php | 10 +++++----- mod/uexport.php | 2 +- mod/uimport.php | 2 +- src/Content/Feature.php | 4 ++-- src/Model/User.php | 8 ++++---- 17 files changed, 52 insertions(+), 52 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index 94f591874..e0f9856ba 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1217,7 +1217,7 @@ function format_like($cnt, array $arr, $type, $id) { } if ($total >= MAX_LIKERS) { $str = implode(', ', $arr); - $str .= L10n::t(', and %d other people', $total - MAX_LIKERS ); + $str .= L10n::t('and %d other people', $total - MAX_LIKERS ); } $likers = $str; @@ -1280,7 +1280,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) '$term' => L10n::t('Tag term:'), '$fileas' => L10n::t('Save to Folder:'), '$whereareu' => L10n::t('Where are you right now?'), - '$delitems' => L10n::t('Delete item(s)?') + '$delitems' => L10n::t("Delete item\x28s\x29?") ]); $tpl = get_markup_template('jot-end.tpl'); @@ -1347,7 +1347,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) '$title' => defaults($x, 'title', ''), '$placeholdertitle' => L10n::t('Set title'), '$category' => defaults($x, 'category', ''), - '$placeholdercategory' => Feature::isEnabled(local_user(), 'categories') ? L10n::t('Categories (comma-separated list)') : '', + '$placeholdercategory' => Feature::isEnabled(local_user(), 'categories') ? L10n::t("Categories \x28comma-separated list\x29") : '', '$wait' => L10n::t('Please wait'), '$permset' => L10n::t('Permission settings'), '$shortpermset' => L10n::t('permissions'), diff --git a/include/enotify.php b/include/enotify.php index 44fca484c..f07215da9 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -347,7 +347,7 @@ function notification($params) '[url='.$params['source_link'].']'.$params['source_name'].'[/url]' ); - $body = L10n::t('\'%1$s\' has chosen to accept you a "fan", which restricts some forms of communication - such as private messaging and some profile interactions. If this is a celebrity or community page, these settings were applied automatically.', $params['source_name']); + $body = L10n::t('\'%1$s\' has chosen to accept you a fan, which restricts some forms of communication - such as private messaging and some profile interactions. If this is a celebrity or community page, these settings were applied automatically.', $params['source_name']); $body .= "\n\n"; $body .= L10n::t('\'%1$s\' may choose to extend this into a two-way or more permissive relationship in the future.', $params['source_name']); @@ -369,7 +369,7 @@ function notification($params) '[url='.$params['source_link'].']'.$params['source_name'].'[/url]' ); - $body = L10n::t('Full Name: %1$s\nSite Location: %2$s\nLogin Name: %3$s (%4$s)', + $body = L10n::t('Full Name: %1$s\nSite Location: %2$s\nLogin Name: %3$s ' . "\x28" . '%4$s' . "\x28", $params['source_name'], $siteurl, $params['source_mail'], $params['source_nick'] diff --git a/include/security.php b/include/security.php index 39846a832..001154293 100644 --- a/include/security.php +++ b/include/security.php @@ -404,7 +404,7 @@ function check_form_security_token($typename = '', $formname = 'form_security_to function check_form_security_std_err_msg() { - return L10n::t('The form security token was not correct. This probably happened because the form has been opened for too long (>3 hours) before submitting it.') . EOL; + return L10n::t("The form security token was not correct. This probably happened because the form has been opened for too long \x28>3 hours\x29 before submitting it.") . EOL; } function check_form_security_token_redirectOnErr($err_redirect, $typename = '', $formname = 'form_security_token') diff --git a/mod/admin.php b/mod/admin.php index 34514f207..a420a77d0 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -380,7 +380,7 @@ function admin_page_contactblock_post(App $a) Contact::block($contact_id); notice(L10n::t('The contact has been blocked from the node')); } else { - notice(L10n::t('Could not find any contact entry for this URL (%s)', $contact_url)); + notice(L10n::t("Could not find any contact entry for this URL \x28%s\x29", $contact_url)); } } if (x($_POST, 'page_contactblock_unblock')) { @@ -1223,7 +1223,7 @@ function admin_page_site(App $a) $ssl_choices = [ SSL_POLICY_NONE => L10n::t("No SSL policy, links will track page SSL state"), SSL_POLICY_FULL => L10n::t("Force all links to use SSL"), - SSL_POLICY_SELFSIGN => L10n::t("Self-signed certificate, use SSL for local links only (discouraged)") + SSL_POLICY_SELFSIGN => L10n::t("Self-signed certificate, use SSL for local links only \x28discouraged\x29") ]; $check_git_version_choices = [ @@ -1287,7 +1287,7 @@ function admin_page_site(App $a) '$abandon_days' => ['abandon_days', L10n::t('Accounts abandoned after x days'), Config::get('system','account_abandon_days'), L10n::t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')], '$allowed_sites' => ['allowed_sites', L10n::t("Allowed friend domains"), Config::get('system','allowed_sites'), L10n::t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")], '$allowed_email' => ['allowed_email', L10n::t("Allowed email domains"), Config::get('system','allowed_email'), L10n::t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")], - '$no_oembed_rich_content' => ['no_oembed_rich_content', L10n::t("No OEmbed rich content"), Config::get('system','no_oembed_rich_content'), L10n::t("Don't show the rich content (e.g. embedded PDF), except from the domains listed below.")], + '$no_oembed_rich_content' => ['no_oembed_rich_content', L10n::t("No OEmbed rich content"), Config::get('system','no_oembed_rich_content'), L10n::t("Don't show the rich content \x28e.g. embedded PDF\x29, except from the domains listed below.")], '$allowed_oembed' => ['allowed_oembed', L10n::t("Allowed OEmbed domains"), Config::get('system','allowed_oembed'), L10n::t("Comma separated list of domains which oembed content is allowed to be displayed. Wildcards are accepted.")], '$block_public' => ['block_public', L10n::t("Block public"), Config::get('system','block_public'), L10n::t("Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.")], '$force_publish' => ['publish_all', L10n::t("Force publish"), Config::get('system','publish_all'), L10n::t("Check to force all profiles on this site to be listed in the site directory.")], @@ -1301,7 +1301,7 @@ function admin_page_site(App $a) '$no_openid' => ['no_openid', L10n::t("OpenID support"), !Config::get('system','no_openid'), L10n::t("OpenID support for registration and logins.")], '$no_regfullname' => ['no_regfullname', L10n::t("Fullname check"), !Config::get('system','no_regfullname'), L10n::t("Force users to register with a space between firstname and lastname in Full name, as an antispam measure")], '$community_page_style' => ['community_page_style', L10n::t("Community pages for visitors"), Config::get('system','community_page_style'), L10n::t("Which community pages should be available for visitors. Local users always see both pages."), $community_page_style_choices], - '$max_author_posts_community_page' => ['max_author_posts_community_page', L10n::t("Posts per user on community page"), Config::get('system','max_author_posts_community_page'), L10n::t("The maximum number of posts per user on the community page. (Not valid for 'Global Community')")], + '$max_author_posts_community_page' => ['max_author_posts_community_page', L10n::t("Posts per user on community page"), Config::get('system','max_author_posts_community_page'), L10n::t("The maximum number of posts per user on the community page. \x28Not valid for 'Global Community'\x29")], '$ostatus_disabled' => ['ostatus_disabled', L10n::t("Enable OStatus support"), !Config::get('system','ostatus_disabled'), L10n::t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")], '$ostatus_full_threads' => ['ostatus_full_threads', L10n::t("Only import OStatus threads from our contacts"), Config::get('system','ostatus_full_threads'), L10n::t("Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.")], '$ostatus_not_able' => L10n::t("OStatus support can only be enabled if threading is enabled."), @@ -1309,14 +1309,14 @@ function admin_page_site(App $a) '$diaspora_not_able' => L10n::t("Diaspora support can't be enabled because Friendica was installed into a sub directory."), '$diaspora_enabled' => ['diaspora_enabled', L10n::t("Enable Diaspora support"), Config::get('system','diaspora_enabled'), L10n::t("Provide built-in Diaspora network compatibility.")], '$dfrn_only' => ['dfrn_only', L10n::t('Only allow Friendica contacts'), Config::get('system','dfrn_only'), L10n::t("All contacts must use Friendica protocols. All other built-in communication protocols disabled.")], - '$verifyssl' => ['verifyssl', L10n::t("Verify SSL"), Config::get('system','verifyssl'), L10n::t("If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites.")], + '$verifyssl' => ['verifyssl', L10n::t("Verify SSL"), Config::get('system','verifyssl'), L10n::t("If you wish, you can turn on strict certificate checking. This will mean you cannot connect \x28at all\x29 to self-signed SSL sites.")], '$proxyuser' => ['proxyuser', L10n::t("Proxy user"), Config::get('system','proxyuser'), ""], '$proxy' => ['proxy', L10n::t("Proxy URL"), Config::get('system','proxy'), ""], - '$timeout' => ['timeout', L10n::t("Network timeout"), (x(Config::get('system','curl_timeout'))?Config::get('system','curl_timeout'):60), L10n::t("Value is in seconds. Set to 0 for unlimited (not recommended).")], + '$timeout' => ['timeout', L10n::t("Network timeout"), (x(Config::get('system','curl_timeout'))?Config::get('system','curl_timeout'):60), L10n::t("Value is in seconds. Set to 0 for unlimited \x28not recommended\x29.")], '$maxloadavg' => ['maxloadavg', L10n::t("Maximum Load Average"), ((intval(Config::get('system','maxloadavg')) > 0)?Config::get('system','maxloadavg'):50), L10n::t("Maximum system load before delivery and poll processes are deferred - default 50.")], - '$maxloadavg_frontend' => ['maxloadavg_frontend', L10n::t("Maximum Load Average (Frontend)"), ((intval(Config::get('system','maxloadavg_frontend')) > 0)?Config::get('system','maxloadavg_frontend'):50), L10n::t("Maximum system load before the frontend quits service - default 50.")], - '$min_memory' => ['min_memory', L10n::t("Minimal Memory"), ((intval(Config::get('system','min_memory')) > 0)?Config::get('system','min_memory'):0), L10n::t("Minimal free memory in MB for the worker. Needs access to /proc/meminfo - default 0 (deactivated).")], - '$optimize_max_tablesize'=> ['optimize_max_tablesize', L10n::t("Maximum table size for optimization"), $optimize_max_tablesize, L10n::t("Maximum table size (in MB) for the automatic optimization - default 100 MB. Enter -1 to disable it.")], + '$maxloadavg_frontend' => ['maxloadavg_frontend', L10n::t("Maximum Load Average \x28Frontend\x29"), ((intval(Config::get('system','maxloadavg_frontend')) > 0)?Config::get('system','maxloadavg_frontend'):50), L10n::t("Maximum system load before the frontend quits service - default 50.")], + '$min_memory' => ['min_memory', L10n::t("Minimal Memory"), ((intval(Config::get('system','min_memory')) > 0)?Config::get('system','min_memory'):0), L10n::t("Minimal free memory in MB for the worker. Needs access to /proc/meminfo - default 0 \x28deactivated\x29.")], + '$optimize_max_tablesize'=> ['optimize_max_tablesize', L10n::t("Maximum table size for optimization"), $optimize_max_tablesize, L10n::t("Maximum table size \x28in MB\x29 for the automatic optimization - default 100 MB. Enter -1 to disable it.")], '$optimize_fragmentation'=> ['optimize_fragmentation', L10n::t("Minimum level of fragmentation"), ((intval(Config::get('system','optimize_fragmentation')) > 0)?Config::get('system','optimize_fragmentation'):30), L10n::t("Minimum fragmenation level to start the automatic optimization - default value is 30%.")], '$poco_completion' => ['poco_completion', L10n::t("Periodical check of global contacts"), Config::get('system','poco_completion'), L10n::t("If enabled, the global contacts are checked periodically for missing or outdated data and the vitality of the contacts and servers.")], @@ -1330,7 +1330,7 @@ function admin_page_site(App $a) '$check_new_version_url' => ['check_new_version_url', L10n::t("Check upstream version"), Config::get('system', 'check_new_version_url'), L10n::t("Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview."), $check_git_version_choices], '$suppress_tags' => ['suppress_tags', L10n::t("Suppress Tags"), Config::get('system','suppress_tags'), L10n::t("Suppress showing a list of hashtags at the end of the posting.")], '$itemcache' => ['itemcache', L10n::t("Path to item cache"), Config::get('system','itemcache'), L10n::t("The item caches buffers generated bbcode and external images.")], - '$itemcache_duration' => ['itemcache_duration', L10n::t("Cache duration in seconds"), Config::get('system','itemcache_duration'), L10n::t("How long should the cache files be hold? Default value is 86400 seconds (One day). To disable the item cache, set the value to -1.")], + '$itemcache_duration' => ['itemcache_duration', L10n::t("Cache duration in seconds"), Config::get('system','itemcache_duration'), L10n::t("How long should the cache files be hold? Default value is 86400 seconds \x28One day\x29. To disable the item cache, set the value to -1.")], '$max_comments' => ['max_comments', L10n::t("Maximum numbers of comments per post"), Config::get('system','max_comments'), L10n::t("How much comments should be shown for each post? Default value is 100.")], '$temppath' => ['temppath', L10n::t("Temp path"), Config::get('system','temppath'), L10n::t("If you have a restricted system where the webserver can't access the system temp path, enter another path here.")], '$basepath' => ['basepath', L10n::t("Base path to installation"), Config::get('system','basepath'), L10n::t("If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot.")], @@ -1344,7 +1344,7 @@ function admin_page_site(App $a) '$worker_queues' => ['worker_queues', L10n::t("Maximum number of parallel workers"), Config::get('system','worker_queues'), L10n::t("On shared hosters set this to 2. On larger systems, values of 10 are great. Default value is 4.")], '$worker_dont_fork' => ['worker_dont_fork', L10n::t("Don't use 'proc_open' with the worker"), Config::get('system','worker_dont_fork'), L10n::t("Enable this if your system doesn't allow the use of 'proc_open'. This can happen on shared hosters. If this is enabled you should increase the frequency of worker calls in your crontab.")], '$worker_fastlane' => ['worker_fastlane', L10n::t("Enable fastlane"), Config::get('system','worker_fastlane'), L10n::t("When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.")], - '$worker_frontend' => ['worker_frontend', L10n::t('Enable frontend worker'), Config::get('system','frontend_worker'), L10n::t('When enabled the Worker process is triggered when backend access is performed (e.g. messages being delivered). On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.', System::baseUrl())], + '$worker_frontend' => ['worker_frontend', L10n::t('Enable frontend worker'), Config::get('system','frontend_worker'), L10n::t('When enabled the Worker process is triggered when backend access is performed \x28e.g. messages being delivered\x29. On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.', System::baseUrl())], '$form_security_token' => get_form_security_token("admin_site") ]); @@ -1431,7 +1431,7 @@ function admin_page_dbsync(App $a) '$base' => System::baseUrl(true), '$banner' => L10n::t('Failed Updates'), '$desc' => L10n::t('This does not include updates prior to 1139, which did not return a status.'), - '$mark' => L10n::t('Mark success (if update was manually applied)'), + '$mark' => L10n::t("Mark success \x28if update was manually applied\x29"), '$apply' => L10n::t('Attempt to execute this update step automatically'), '$failed' => $failed ]); @@ -1487,10 +1487,10 @@ function admin_page_users_post(App $a) Please take a few moments to review the other account settings on that page. You may also wish to add some basic information to your default profile - (on the "Profiles" page) so that other people can easily find you. + ' . "\x28" . 'on the "Profiles" page' . "\x29" . ' so that other people can easily find you. We recommend setting your full name, adding a profile photo, - adding some profile "keywords" (very useful in making new friends) - and + adding some profile "keywords" ' . "\x28" . 'very useful in making new friends' . "\x29" . ' - and perhaps what country you live in; if you do not wish to be more specific than that. @@ -2228,11 +2228,11 @@ function admin_page_viewlogs(App $a) $data = ''; if (!file_exists($f)) { - $data = L10n::t("Error trying to open $f log file.\r\n
Check to see if file $f exist and is readable."); + $data = L10n::t('Error trying to open %1$s log file.\r\n
Check to see if file %1$s exist and is readable.', $f); } else { $fp = fopen($f, 'r'); if (!$fp) { - $data = L10n::t("Couldn't open $f log file.\r\n
Check to see if file $f is readable."); + $data = L10n::t('Couldn\'t open %1$s log file.\r\n
Check to see if file %1$s is readable.', $f); } else { $fstat = fstat($fp); $size = $fstat['size']; diff --git a/mod/babel.php b/mod/babel.php index 4d6f3c8b8..3b4fb5bf2 100644 --- a/mod/babel.php +++ b/mod/babel.php @@ -19,14 +19,14 @@ function babel_content() $o = '

Babel Diagnostic

'; $o .= '
'; - $o .= L10n::t('Source (bbcode) text:') . EOL; + $o .= L10n::t("Source \x28bbcode\x29 text:") . EOL; $o .= '' . EOL; $o .= '
'; $o .= '

'; $o .= '
'; - $o .= L10n::t('Source (Diaspora) text to convert to BBcode:') . EOL; + $o .= L10n::t("Source \x28Diaspora\x29 text to convert to BBcode:") . EOL; $o .= '' . EOL; $o .= '
'; @@ -38,7 +38,7 @@ function babel_content() $o .= visible_lf($text) . EOL . EOL; $html = bbcode($text); - $o .= '

' . L10n::t('bbcode (raw HTML): ') . '

' . EOL . EOL; + $o .= '

' . L10n::t("bbcode \x28raw HTML\x28: ") . '

' . EOL . EOL; $o .= htmlspecialchars($html) . EOL . EOL; //$html = bbcode($text); @@ -68,7 +68,7 @@ function babel_content() if (x($_REQUEST, 'd2bbtext')) { $d2bbtext = trim($_REQUEST['d2bbtext']); - $o .= '

' . L10n::t('Source input (Diaspora format): ') . '

' . EOL . EOL; + $o .= '

' . L10n::t("Source input \x28Diaspora format\x29: ") . '

' . EOL . EOL; $o .= '
' . $d2bbtext . '
' . EOL . EOL; $bb = diaspora2bb($d2bbtext); diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 57bba3595..aada465ad 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -651,8 +651,8 @@ function dfrn_request_content(App $a) '$add_note' => L10n::t('Add a personal note:'), '$page_desc' => $page_desc, '$friendica' => L10n::t('Friendica'), - '$statusnet' => L10n::t('GNU Social (Pleroma, Mastodon)'), - '$diaspora' => L10n::t('Diaspora (Socialhome, Hubzilla)'), + '$statusnet' => L10n::t("GNU Social \x28Pleroma, Mastodon\x29"), + '$diaspora' => L10n::t("Diaspora \x28Socialhome, Hubzilla\x29"), '$diasnote' => L10n::t(' - please do not use this form. Instead, enter %s into your Diaspora search bar.', $target_addr), '$your_address' => L10n::t('Your Identity Address:'), '$invite_desc' => $invite_desc, diff --git a/mod/editpost.php b/mod/editpost.php index 90a153453..af8f4e317 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -136,7 +136,7 @@ function editpost_content(App $a) { '$title' => htmlspecialchars($itm[0]['title']), '$placeholdertitle' => L10n::t('Set title'), '$category' => file_tag_file_to_list($itm[0]['file'], 'category'), - '$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t('Categories (comma-separated list)') : ''), + '$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t("Categories \x28comma-separated list\x29") : ''), '$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'), '$lockstate' => $lockstate, '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)), diff --git a/mod/install.php b/mod/install.php index 76ecdfd9b..cbad3b254 100644 --- a/mod/install.php +++ b/mod/install.php @@ -338,7 +338,7 @@ function check_php(&$phpath, &$checks) { list($result) = explode("\n", $result); $help = ""; if (!$passed2) { - $help .= L10n::t('PHP executable is not the php cli binary (could be cgi-fgci version)'). EOL; + $help .= L10n::t("PHP executable is not the php cli binary \x28could be cgi-fgci version\x29"). EOL; $help .= L10n::t('Found PHP version: ')."$result"; } check_add($checks, L10n::t('PHP cli binary'), $passed2, true, $help); @@ -470,8 +470,8 @@ function check_smarty3(&$checks) { $status = false; $help = L10n::t('Friendica uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL; $help .= L10n::t('In order to store these compiled templates, the web server needs to have write access to the directory view/smarty3/ under the Friendica top level folder.').EOL; - $help .= L10n::t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL; - $help .= L10n::t('Note: as a security measure, you should give the web server write access to view/smarty3/ only--not the template files (.tpl) that it contains.').EOL; + $help .= L10n::t("Please ensure that the user that your web server runs as \x28e.g. www-data\x29 has write access to this folder.").EOL; + $help .= L10n::t("Note: as a security measure, you should give the web server write access to view/smarty3/ only--not the template files \x28.tpl\x29 that it contains.").EOL; } check_add($checks, L10n::t('view/smarty3 is writable'), $status, true, $help); @@ -549,6 +549,6 @@ function what_next() { ."

".L10n::t('IMPORTANT: You will need to [manually] setup a scheduled task for the worker.') .L10n::t('Please see the file "INSTALL.txt".') ."

" - .L10n::t("Go to your new Friendica node registration page and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.") + .L10n::t('Go to your new Friendica node registration page and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.', $baseurl) ."

"; } diff --git a/mod/lostpass.php b/mod/lostpass.php index 5b7f7af26..c39a38cca 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -147,8 +147,8 @@ function lostpass_generate_password($user) $preamble = deindent(L10n::t(' Dear %1$s, Your password has been changed as requested. Please retain this - information for your records (or change your password immediately to - something that you will remember). + information for your records ' . "\x28" . 'or change your password immediately to + something that you will remember' . "\x29" . '. ', $user['username'])); $body = deindent(L10n::t(' Your login details are as follows: diff --git a/mod/photos.php b/mod/photos.php index a789ac641..227f5d2a3 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1469,8 +1469,8 @@ function photos_content(App $a) '$caption' => ['desc', L10n::t('Caption'), $caption_e, ''], '$tags' => ['newtag', L10n::t('Add a Tag'), "", L10n::t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping')], '$rotate_none' => ['rotate', L10n::t('Do not rotate'),0,'', true], - '$rotate_cw' => ['rotate', L10n::t('Rotate CW (right)'),1,''], - '$rotate_ccw' => ['rotate', L10n::t('Rotate CCW (left)'),2,''], + '$rotate_cw' => ['rotate', L10n::t("Rotate CW \x28right\x29"),1,''], + '$rotate_ccw' => ['rotate', L10n::t("Rotate CCW \x28left\x29"),2,''], '$nickname' => $a->data['user']['nickname'], '$resource_id' => $ph[0]['resource-id'], diff --git a/mod/profiles.php b/mod/profiles.php index 87081a4da..6c581269c 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -724,7 +724,7 @@ function profiles_content(App $a) { '$howlong' => ['howlong', L10n::t('Since [date]:'), ($r[0]['howlong'] <= NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))], '$sexual' => ContactSelector::sexualPreference($r[0]['sexual']), '$about' => ['about', L10n::t('Tell us about yourself...'), $r[0]['about']], - '$xmpp' => ['xmpp', L10n::t('XMPP (Jabber) address:'), $r[0]['xmpp'], L10n::t("The XMPP address will be propagated to your contacts so that they can follow you.")], + '$xmpp' => ['xmpp', L10n::t("XMPP \x28Jabber\x29 address:"), $r[0]['xmpp'], L10n::t("The XMPP address will be propagated to your contacts so that they can follow you.")], '$homepage' => ['homepage', L10n::t('Homepage URL:'), $r[0]['homepage']], '$hometown' => ['hometown', L10n::t('Hometown:'), $r[0]['hometown']], '$politic' => ['politic', L10n::t('Political Views:'), $r[0]['politic']], diff --git a/mod/register.php b/mod/register.php index a2f5ddc51..6466458a7 100644 --- a/mod/register.php +++ b/mod/register.php @@ -265,7 +265,7 @@ function register_content(App $a) '$oidlabel' => $oidlabel, '$openid' => $openid_url, '$namelabel' => L10n::t('Your Full Name ' . "\x28" . 'e.g. Joe Smith, real or real-looking' . "\x29" . ': '), - '$addrlabel' => L10n::t('Your Email Address: (Initial information will be send there, so this has to be an existing address.)'), + '$addrlabel' => L10n::t("Your Email Address: \x28Initial information will be send there, so this has to be an existing address.\x29"), '$passwords' => $passwords, '$password1' => ['password1', L10n::t('New Password:'), '', L10n::t('Leave empty for an auto generated password.')], '$password2' => ['confirm', L10n::t('Confirm:'), '', ''], diff --git a/mod/settings.php b/mod/settings.php index 2d8d3a605..5b4bd903e 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -804,7 +804,7 @@ function settings_content(App $a) if (is_site_admin()) { $diasp_enabled = L10n::t('Built-in support for %s connectivity is %s', L10n::t('Diaspora'), ((Config::get('system', 'diaspora_enabled')) ? L10n::t('enabled') : L10n::t('disabled'))); - $ostat_enabled = L10n::t('Built-in support for %s connectivity is %s', L10n::t('GNU Social (OStatus)'), ((Config::get('system', 'ostatus_disabled')) ? L10n::t('disabled') : L10n::t('enabled'))); + $ostat_enabled = L10n::t('Built-in support for %s connectivity is %s', L10n::t("GNU Social \x28OStatus\x29"), ((Config::get('system', 'ostatus_disabled')) ? L10n::t('disabled') : L10n::t('enabled'))); } else { $diasp_enabled = ""; $ostat_enabled = ""; @@ -847,9 +847,9 @@ function settings_content(App $a) '$general_settings' => L10n::t('General Social Media Settings'), '$no_intelligent_shortening' => ['no_intelligent_shortening', L10n::t('Disable intelligent shortening'), $no_intelligent_shortening, L10n::t('Normally the system tries to find the best link to add to shortened posts. If this option is enabled then every shortened post will always point to the original friendica post.')], - '$ostatus_autofriend' => ['snautofollow', L10n::t('Automatically follow any GNU Social (OStatus) followers/mentioners'), $ostatus_autofriend, L10n::t('If you receive a message from an unknown OStatus user, this option decides what to do. If it is checked, a new contact will be created for every unknown user.')], + '$ostatus_autofriend' => ['snautofollow', L10n::t("Automatically follow any GNU Social \x28OStatus\x29 followers/mentioners"), $ostatus_autofriend, L10n::t('If you receive a message from an unknown OStatus user, this option decides what to do. If it is checked, a new contact will be created for every unknown user.')], '$default_group' => Group::displayGroupSelection(local_user(), $default_group, L10n::t("Default group for OStatus contacts")), - '$legacy_contact' => ['legacy_contact', L10n::t('Your legacy GNU Social account'), $legacy_contact, L10n::t('If you enter your old GNU Social/Statusnet account name here (in the format user@domain.tld), your contacts will be added automatically. The field will be emptied when done.')], + '$legacy_contact' => ['legacy_contact', L10n::t('Your legacy GNU Social account'), $legacy_contact, L10n::t("If you enter your old GNU Social/Statusnet account name here \x28in the format user@domain.tld\x29, your contacts will be added automatically. The field will be emptied when done.")], '$repair_ostatus_url' => System::baseUrl() . '/repair_ostatus', '$repair_ostatus_text' => L10n::t('Repair OStatus subscriptions'), @@ -911,9 +911,9 @@ function settings_content(App $a) if (!$is_experimental || ($is_experimental && (Config::get('experimentals', 'exp_themes')==1 || is_null(Config::get('experimentals', 'exp_themes'))))) { $theme_name = ucfirst($theme); if ($is_unsupported) { - $theme_name = L10n::t("%s - (Unsupported)", $theme_name); + $theme_name = L10n::t("%s - \x28Unsupported\x29", $theme_name); } elseif ($is_experimental) { - $theme_name = L10n::t("%s - (Experimental)", $theme_name); + $theme_name = L10n::t("%s - \x28Experimental\x29", $theme_name); } if ($is_mobile) { $mobile_themes[$theme] = $theme_name; diff --git a/mod/uexport.php b/mod/uexport.php index c6f76cfce..552c91dcc 100644 --- a/mod/uexport.php +++ b/mod/uexport.php @@ -42,7 +42,7 @@ function uexport_content(App $a) { */ $options = [ ['uexport/account', L10n::t('Export account'), L10n::t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')], - ['uexport/backup', L10n::t('Export all'), L10n::t('Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account (photos are not exported)')], + ['uexport/backup', L10n::t('Export all'), L10n::t("Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account \x28photos are not exported\x29")], ]; Addon::callHooks('uexport_options', $options); diff --git a/mod/uimport.php b/mod/uimport.php index a1b0e4d14..7d6805e7c 100644 --- a/mod/uimport.php +++ b/mod/uimport.php @@ -72,7 +72,7 @@ function uimport_content(App $a) { 'title' => L10n::t("Move account"), 'intro' => L10n::t("You can import an account from another Friendica server."), 'instruct' => L10n::t("You need to export your account from the old server and upload it here. We will recreate your old account here with all your contacts. We will try also to inform your friends that you moved here."), - 'warn' => L10n::t("This feature is experimental. We can't import contacts from the OStatus network (GNU Social/Statusnet) or from Diaspora"), + 'warn' => L10n::t("This feature is experimental. We can't import contacts from the OStatus network \x28GNU Social/Statusnet\x29 or from Diaspora"), 'field' => ['accountfile', L10n::t('Account file'), '', L10n::t('To export your account, go to "Settings->Export your personal data" and select "Export account"')], ], ]); diff --git a/src/Content/Feature.php b/src/Content/Feature.php index 71b186034..fc5bb9717 100644 --- a/src/Content/Feature.php +++ b/src/Content/Feature.php @@ -79,7 +79,7 @@ class Feature L10n::t('General Features'), //array('expire', L10n::t('Content Expiration'), L10n::t('Remove old posts/comments after a period of time')), ['multi_profiles', L10n::t('Multiple Profiles'), L10n::t('Ability to create multiple profiles'), false, Config::get('feature_lock', 'multi_profiles', false)], - ['photo_location', L10n::t('Photo Location'), L10n::t('Photo metadata is normally stripped. This extracts the location (if present) prior to stripping metadata and links it to a map.'), false, Config::get('feature_lock', 'photo_location', false)], + ['photo_location', L10n::t('Photo Location'), L10n::t("Photo metadata is normally stripped. This extracts the location \x28if present\x29 prior to stripping metadata and links it to a map."), false, Config::get('feature_lock', 'photo_location', false)], ['export_calendar', L10n::t('Export Public Calendar'), L10n::t('Ability for visitors to download the public calendar'), false, Config::get('feature_lock', 'export_calendar', false)], ], @@ -104,7 +104,7 @@ class Feature 'net_tabs' => [ L10n::t('Network Tabs'), ['personal_tab', L10n::t('Network Personal Tab'), L10n::t('Enable tab to display only Network posts that you\'ve interacted on'), false, Config::get('feature_lock', 'personal_tab', false)], - ['new_tab', L10n::t('Network New Tab'), L10n::t('Enable tab to display only new Network posts (from the last 12 hours)'), false, Config::get('feature_lock', 'new_tab', false)], + ['new_tab', L10n::t('Network New Tab'), L10n::t("Enable tab to display only new Network posts \x28from the last 12 hours\x29"), false, Config::get('feature_lock', 'new_tab', false)], ['link_tab', L10n::t('Network Shared Links Tab'), L10n::t('Enable tab to display only Network posts with links in them'), false, Config::get('feature_lock', 'link_tab', false)], ], diff --git a/src/Model/User.php b/src/Model/User.php index b4171de95..07df7ca61 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -353,7 +353,7 @@ class User $nickname = $data['nickname'] = strtolower($nickname); if (!preg_match('/^[a-z0-9][a-z0-9\_]*$/', $nickname)) { - throw new Exception(L10n::t('Your "nickname" can only contain "a-z", "0-9" and "_".')); + throw new Exception(L10n::t('Your nickname can only contain a-z, 0-9 and _.')); } // Check existing and deleted accounts for this nickname. @@ -560,16 +560,16 @@ class User Login Name: %1$s Password: %5$s - You may change your password from your account "Settings" page after logging + You may change your password from your account Settings page after logging in. Please take a few moments to review the other account settings on that page. You may also wish to add some basic information to your default profile - (on the "Profiles" page) so that other people can easily find you. + ' . "\x28" . 'on the "Profiles" page' . "\x29" . ' so that other people can easily find you. We recommend setting your full name, adding a profile photo, - adding some profile "keywords" (very useful in making new friends) - and + adding some profile keywords ' . "\x28" . 'very useful in making new friends' . "\x29" . ' - and perhaps what country you live in; if you do not wish to be more specific than that. From 3e7f683533f3ee393a3899b632be480d3884d727 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 24 Jan 2018 16:53:57 -0500 Subject: [PATCH 2/4] Fix util/extract.php - Captures way more L10n::t(t) instances - Add recursive search into `src/` folder - Fix string capture with new sprintf-free syntax --- util/extract.php | 139 ++++++++++++++++++++++++++++++----------------- 1 file changed, 88 insertions(+), 51 deletions(-) mode change 100644 => 100755 util/extract.php diff --git a/util/extract.php b/util/extract.php old mode 100644 new mode 100755 index 13151bc96..18fbb9df0 --- a/util/extract.php +++ b/util/extract.php @@ -1,63 +1,100 @@ +#!/usr/bin/env php strings[' . $a[0] . "] = array(\n"; - $s .= "\t0 => ". $a[0]. ",\n"; - $s .= "\t1 => ". $a[1]. ",\n"; - $s .= ");\n"; - } else { - if(substr($a,0,1) == '$') - continue; - $s .= '$a->strings[' . $a . '] = '. $a . ';' . "\n"; +$arr = []; + +$files = ['index.php', 'boot.php']; +$files = array_merge( + $files, + glob('mod/*'), + glob('include/*'), + glob('addon/*/*'), + glob_recursive('src') +); + +foreach ($files as $file) { + $str = file_get_contents($file); + + $pat = '|L10n::t\(([^\)]*+)[\)]|'; + $patt = '|L10n::tt\(([^\)]*+)[\)]|'; + + preg_match_all($pat, $str, $matches); + preg_match_all($patt, $str, $matchestt); + + if (count($matches) || count($matchestt)) { + $s .= '// ' . $file . PHP_EOL; + } + + if (count($matches)) { + foreach ($matches[1] as $long_match) { + $match_arr = preg_split('/(?<=[\'"])\s*,/', $long_match); + $match = $match_arr[0]; + if (!in_array($match, $arr)) { + if (substr($match, 0, 1) == '$') { + continue; + } + + $arr[] = $match; + + $s .= '$a->strings[' . $match . '] = ' . $match . ';' . "\n"; + } + } + } + if (count($matchestt)) { + foreach ($matchestt[1] as $match) { + $matchtkns = preg_split("|[ \t\r\n]*,[ \t\r\n]*|", $match); + if (count($matchtkns) == 3 && !in_array($matchtkns[0], $arr)) { + if (substr($matchtkns[1], 0, 1) == '$') { + continue; + } + + $arr[] = $matchtkns[0]; + + $s .= '$a->strings[' . $matchtkns[0] . "] = array(\n"; + $s .= "\t0 => " . $matchtkns[0] . ",\n"; + $s .= "\t1 => " . $matchtkns[1] . ",\n"; + $s .= ");\n"; + } + } + } +} + +$s .= '// Timezones' . PHP_EOL; + +$zones = timezone_identifiers_list(); +foreach ($zones as $zone) { + $s .= '$a->strings[\'' . $zone . '\'] = \'' . $zone . '\';' . "\n"; +} + +echo $s; + +function glob_recursive($path) { + $dir_iterator = new RecursiveDirectoryIterator($path); + $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST); + + $return = []; + foreach ($iterator as $file) { + if ($file->getBasename() != '.' && $file->getBasename() != '..') { + $return[] = $file->getPathname(); } } - $zones = timezone_identifiers_list(); - foreach($zones as $zone) - $s .= '$a->strings[\'' . $zone . '\'] = \'' . $zone . '\';' . "\n"; - - echo $s; \ No newline at end of file + return $return; +} From e51c4a38ad463d5cc26f0e940523126b89c91e4d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 24 Jan 2018 16:54:52 -0500 Subject: [PATCH 3/4] Fix util/php2po - Remove use - Simplify object handling - Fix wrong `|| die()` structure --- util/php2po.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) mode change 100644 => 100755 util/php2po.php diff --git a/util/php2po.php b/util/php2po.php old mode 100644 new mode 100755 index cc3b00e71..e28c91daf --- a/util/php2po.php +++ b/util/php2po.php @@ -1,3 +1,4 @@ +#!/usr/bin/env php */ -use Friendica\App; - DEFINE("NORM_REGEXP", "|[\\\]|"); -if(! class_exists('App')) { - class TmpA { - public $strings = []; - } - $a = new TmpA(); -} +$a = new stdClass(); if ($argc<2 || in_array('-h', $argv) || in_array('--h', $argv)) { print "Usage: ".$argv[0]." [-p ] \n\n"; @@ -93,8 +87,14 @@ print "\nLoading base message.po..."; // load base messages.po and extract msgids $base_msgids = []; $norm_base_msgids = []; -$base_f = file("util/messages.po") || die("No base messages.po\n"); -$_f = 0; $_mid = ""; $_mids = []; +$base_f = file("util/messages.po"); +if (!$base_f) { + die("No base messages.po\n"); +} + +$_f = 0; +$_mid = ""; +$_mids = []; foreach( $base_f as $l) { $l = trim($l); //~ print $l."\n"; From 113539e29a64e1ff8889277b1b5c20a8a249995b Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 24 Jan 2018 16:55:09 -0500 Subject: [PATCH 4/4] Make util/po2php executable --- util/po2php.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 util/po2php.php diff --git a/util/po2php.php b/util/po2php.php old mode 100644 new mode 100755 index e1d3f5036..819f99b80 --- a/util/po2php.php +++ b/util/po2php.php @@ -1,7 +1,7 @@ +#!/usr/bin/env php