{"id":34638747,"url":"https://github.com/generoi/theme-translation-for-polylang","last_synced_at":"2026-05-29T05:31:09.796Z","repository":{"id":147858777,"uuid":"337864266","full_name":"generoi/theme-translation-for-polylang","owner":"generoi","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-10T14:24:48.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-26T06:16:01.478Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/generoi.png","metadata":{"files":{"readme":"readme.txt","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-10T21:54:38.000Z","updated_at":"2024-09-10T14:32:36.000Z","dependencies_parsed_at":"2023-04-20T00:08:18.097Z","dependency_job_id":null,"html_url":"https://github.com/generoi/theme-translation-for-polylang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/generoi/theme-translation-for-polylang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generoi%2Ftheme-translation-for-polylang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generoi%2Ftheme-translation-for-polylang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generoi%2Ftheme-translation-for-polylang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generoi%2Ftheme-translation-for-polylang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/generoi","download_url":"https://codeload.github.com/generoi/theme-translation-for-polylang/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generoi%2Ftheme-translation-for-polylang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33639050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T17:13:03.097Z","updated_at":"2026-05-29T05:31:09.782Z","avatar_url":"https://github.com/generoi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"=== Theme and plugin translation for Polylang (TTfP) ===\r\nContributors: marcinkazmierski\r\nTags: polylang, translate, translation, languages, multilanguage\r\nRequires at least: 5.7\r\nTested up to: 6.6\r\nRequires PHP: 7.0\r\nStable tag: 3.4.7\r\nLicense: GPL2\r\n\r\nTheme and plugin translation using Polylang for WordPress.\r\nExtension for Polylang plugin.\r\n\r\n== Description ==\r\n= What is \"Theme and plugin translation for Polylang\"? =\r\n\r\nExtension for Polylang plugin (Polylang is an extension to make multilingual WordPress websites.).\r\nPlugin is needed to translate the WordPress themes and plugins by Polylang.\r\n\r\n= How to configure it? =\r\n\r\nSelect themes and plugins to find texts for translation by Polylang.\r\nIn admin dashboard:\r\n\r\n`Languages -\u003e TTfP Settings`\r\n\r\n= How it is work? =\r\n\r\n\"Theme and plugin translation for Polylang\" automatically searches all files of WordPress themes and plugins. It chooses from this file only those files with extensions:\r\n\r\n*\tphp\r\n*\tinc\r\n*\ttwig\r\n\r\nIn addition, is implemented the integration with Timber library (read more: http://timber.upstatement.com) – which allows to translate twig's skins in simple way.\r\nPlugin in searched skins or plugins chooses texts from Polylang functions, such as:\r\n\r\n*    _e(string $text, string $domain = 'default');\r\n*    __(string $text, string $domain = 'default');\r\n*    _x(string $text, string $context, string $domain = 'default');\r\n*    pll_e(string $text);\r\n*    pll__(string $text);\r\n*    esc_html(string $text);\r\n*    esc_html_e(string $text, string $domain = 'default');\r\n*    esc_html__(string $text, string $domain = 'default');\r\n*    _n(string $single, string $plural, int $number, string $domain = 'default');\r\n*    esc_attr_e(string $text, string $domain = 'default');\r\n*    esc_attr__(string $text, string $domain = 'default');\r\n\r\nIn your function.php, themes or plugins.\r\n\r\nFor example:\r\n\r\n`\u003cp\u003e\u003c?php pll_e('My text'); ?\u003e\u003c/p\u003e`\r\n\r\n`\u003cp\u003e\u003c?php _e('My another text', 'my_theme'); ?\u003e\u003c/p\u003e`\r\n\r\nOn the timber context declare this functions like:\r\n\r\n`$context['pll_e'] = TimberHelper::function_wrapper('pll_e');`\r\n\r\n`$context['pll_'] = TimberHelper::function_wrapper('pll_');`\r\n\r\n\r\nSee more on: `https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/`\r\nThese functions are defined by Polylang plugin for printing translations.\r\nThanks \"Theme and plugin translation for Polylang\" you can find these strings to translate and add to Polylang register on very simple way.\r\nAnd then you can translate these texts from the admin dashboard.\r\nThe scan result can be seen on the tab with translations:\r\n\r\n`Settings -\u003e Languages -\u003e String translation`\r\n\r\nor\r\n\r\n`Languages -\u003e String translation`\r\n\r\n\r\nYou don't need programs like poedit – you don't change files with extensions like: `.pot`, `.po`, `.mo`.\r\n\"Theme and plugin translation for Polylang\" is highly efficient because the scanner is worked only on admin dashboard in tab:\r\nIn dashboard:\r\n\r\n`Settings -\u003e Languages -\u003e String translation`\r\n\r\nor\r\n\r\n`Languages -\u003e String translation`\r\n\r\n\r\n= Export and import string translation =\r\n\r\nIn dashboard:\r\n\r\n`Languages -\u003e TTfP Settings`\r\n\r\n\r\n= Filter reference =\r\n\r\n`ttfp_domains`\r\n\r\nAllows plugins and themes (in functions.php) to modify list of text domains (unique identifier for retrieving translated strings).\r\nList of text domains is displayed on \"TTfP Settings\" page to select them for translation by polylang engine.\r\n\r\nExample:\r\n\r\n`add_filter('ttfp_domains', 'custom_ttfp_domains', 10, 1);\r\nfunction custom_ttfp_domains(array $domains):array\r\n {\r\n     $domains[] = \"my-custom-domain\";\r\n     return $domains;\r\n }`\r\n\r\n= Filter reference =\r\n\r\n`ttfp_translation_access`\r\n\r\nReturns whether the user has capability to view and edit translations provided by TTfP.\r\n\r\nExample:\r\n\r\n`add_filter('ttfp_translation_access', 'custom_ttfp_translation_access', 10, 1);\r\nfunction custom_ttfp_translation_access(bool $hasAccess):bool\r\n {\r\n     return current_user_can('edit_posts');\r\n }`\r\n\r\n== Installation ==\r\nThis plugin requires to be installed and activated the Polylang plugin,\r\nThis plugin requires PHP 7.0\r\n\r\n1. Upload the \"Theme and plugin translation for Polylang\" folder to the `/wp-content/plugins/` directory on your web server.\r\n2. Activate the plugin through the Plugins menu in WordPress.\r\n3. In Dashboard go to the `Settings -\u003e Languages -\u003e String translation` or `Languages -\u003e String translation` and find your texts.\r\n\r\n= Use =\r\n\r\n`\u003c?php\r\n pll_e('My string'); // similar to _e();\r\n // or:\r\n $var = pll_('My string'); // similar to __();\r\n // or:\r\n  _e('My string', 'my_theme');\r\n // or:\r\n  $var = __('My string', 'my_theme');`\r\n\r\n= How to enable Twig extension with \"Theme and plugin translation for Polylang\"? [Timber plugin] =\r\n\r\nIn functions.php add:\r\n\r\n`if (!class_exists('Timber')) {\r\n    add_action('admin_notices', function () {\r\n        echo '\u003cdiv class=\"error\"\u003e\u003cp\u003eTimber not activated. Make sure you activate the plugin in \u003ca href=\"' . esc_url(admin_url('plugins.php#timber')) . '\"\u003e' . esc_url(admin_url('plugins.php')) . '\u003c/a\u003e\u003c/p\u003e\u003c/div\u003e';\r\n    });\r\n    return;\r\n}\r\n\r\nfunction timber_context()\r\n{\r\n    $context = Timber::get_context();\r\n    $post = Timber::query_post();\r\n    $context['post'] = $post;\r\n    $context['pll_e'] = TimberHelper::function_wrapper('pll_e');\r\n    $context['pll__'] = TimberHelper::function_wrapper('pll__');\r\n    return $context;\r\n}\r\n\r\nTimber::$dirname = array('templates', 'views'); // directory names with twig templates\r\ntimber_context();`\r\n\r\nNext, for example in index.php add:\r\n\r\n`\u003c?php\r\n $context = timber_context();\r\n $templates = array('home.twig', 'index.twig'); // twig files for render\r\n Timber::render($templates, $context);\r\n`\r\n\r\nThen you can use in twig templates polylang functions like this (in templates/home.twig):\r\n\r\n`{% extends \"base.twig\" %}\r\n {% block content %}\r\n     \u003cp\u003e\r\n         {{ pll_e(\"Test text on TWIG template 1.\") }}\r\n     \u003c/p\u003e\r\n     \u003cp\u003e\r\n         {{ pll__(\"Test text on TWIG template 2.\") }}\r\n     \u003c/p\u003e\r\n {% endblock %}`\r\n\r\n\r\n== Screenshots ==\r\n\r\n1. Screen show \"Polylang\" strings translations with \"Theme and plugin translation for Polylang\".\r\n2. Export/import translations as CSV file with \"Theme and plugin translation for Polylang\".\r\n3. Settings - Select area to be scanned in Strings translations polylang tab.\r\n\r\n== Changelog ==\r\n= 3.4.7 - 2024/09/01 =\r\n\r\n* Load current language for \"Multilingual Contact Form 7 with Polylang\" plugin in translate_cf7_messages.\r\n\r\n= 3.4.6 - 2024/08/07 =\r\n\r\n* Requires Plugins - by problems with the pro version of Polylang.\r\n\r\n= 3.4.5 - 2024/08/07 =\r\n\r\n* Requires Plugins - by problems with the pro version of Polylang.\r\n\r\n= 3.4.4 - 2024/08/07 =\r\n\r\n* Requires Plugins - allow pro version of polylang.\r\n\r\n= 3.4.3 - 2024/08/06 =\r\n\r\n* Added New Plugin Header -  Requires Plugins.\r\n\r\n= 3.4.2 - 2024/02/15 =\r\n\r\n* Fixed preg_match_all for pll_.\r\n* New option in settings: \"Translate admin dashboard by user preferences (user profile settings)\".\r\n\r\n= 3.4.1 - 2024/01/16 =\r\n\r\n* Fixed 'Call to undefined function get_plugins()'\r\n\r\n= 3.4.0 - 2023/08/03 =\r\n\r\n* Added apply_filters: ttfp_translation_access.\r\n* Fixed force translating the administrator's dashboard.\r\n* Switched to PHP 7.0.\r\n\r\n= 3.3.5 - 2023/04/24 =\r\n\r\n* Fixed text domains of plugins on setting page.\r\n* Fixed pll_admin_current_language filter for translate or no translate admin dashboard.\r\n\r\n= 3.3.4 - 2023/04/03 =\r\n\r\n* Check if function get_plugin_data exist before use.\r\n* Added pll_admin_current_language filter for translate or no translate admin dashboard.\r\n\r\n= 3.3.3 - 2023/01/26 =\r\n\r\n* Include text domain of plugins and themes.\r\n\r\n= 3.3.2 - 2022/12/27 =\r\n\r\n* Fixed notice in Polylang_Theme_Translation_Settings.\r\n\r\n= 3.3.1 - 2022/12/15 =\r\n\r\n* Added apply_filters: ttfp_domains.\r\n\r\n= 3.3.0 - 2022/12/15 =\r\n\r\n* Fixed performance in filters in admin.\r\n* Added temporary cache on polylang translations page (for 60s).\r\n* Added WordPress core and admin string scanner: default domain.\r\n* Loading translations on action: pll_language_defined\r\n\r\n= 3.2.23 - 2022/12/12 =\r\n\r\n* Fixed performance in filters in admin.\r\n\r\n= 3.2.22 - 2022/12/12 =\r\n\r\n* Fixed translators in filters.\r\n\r\n= 3.2.21 - 2022/12/12 =\r\n\r\n* Removed esc_html filter.\r\n\r\n= 3.2.20 - 2022/12/10 =\r\n\r\n* Fixed gettext filter for default domain.\r\n\r\n= 3.2.19 - 2022/11/17 =\r\n\r\n* Security fix.\r\n\r\n= 3.2.18 - 2022/11/17 =\r\n\r\n* Security fix.\r\n\r\n= 3.2.17 - 2022/11/08 =\r\n\r\n* Security fix.\r\n\r\n= 3.2.16 - 2022/11/04 =\r\n\r\n* Fixed gettext filter.\r\n\r\n= 3.2.15 - 2022/11/04 =\r\n\r\n* Fixed gettext filter.\r\n\r\n= 3.2.14 - 2022/11/03 =\r\n\r\n* Fixed gettext filter.\r\n\r\n= 3.2.13 - 2022/05/26 =\r\n\r\n* Updated plugin description.\r\n* Test with Polylang version 3.2.3 and WordPress 6.0.\r\n\r\n= 3.2.12 - 2021/06/15 =\r\n\r\n* Added esc_attr_e and esc_attr__ filter.\r\n\r\n= 3.2.11 - 2021/05/17 =\r\n\r\n* Added esc_html filter.\r\n* Test with WordPress 5.7.2 version and Polylang version 3.0.4.\r\n* Updated version.\r\n\r\n= 3.2.10 - 2021/05/10 =\r\n\r\n* Fixed gettext_with_context filter.\r\n\r\n= 3.2.9 - 2021/05/04 =\r\n\r\n* Updated scanner regex.\r\n\r\n= 3.2.8 - 2021/05/03 =\r\n\r\n* Updated scanner regex.\r\n* Updated readme.\r\n\r\n= 3.2.7 - 2021/05/03 =\r\n\r\n* Updated scanner regex: added esc_html__.\r\n\r\n= 3.2.6 - 2021/04/27 =\r\n\r\n* Updated scanner regex.\r\n* Test with Polylang version 3.0.4.\r\n* Updated version.\r\n\r\n= 3.2.5 - 2021/02/20 =\r\n\r\n* UTF-8 header in csv exporter.\r\n* Test with Polylang version 2.9.2.\r\n* Updated version.\r\n\r\n= 3.2.4 - 2020/09/13 =\r\n\r\n* Added ngettext polylang filter.\r\n* Added to file skaner function _n(): single + plural.\r\n* Test with Polylang version 2.8.2.\r\n* Updated version.\r\n\r\n= 3.2.3 - 2020/03/26 =\r\n\r\n* Updated screens.\r\n* Refactoring.\r\n* Test with Polylang version 2.6.10.\r\n* Updated version.\r\n\r\n= 3.2.2 - 2020/02/02 =\r\n\r\n* Fixed gettext filter.\r\n* Test with WordPress 5.3.2 version and Polylang version 2.6.9.\r\n* Updated version.\r\n\r\n= 3.2.1 - 2019/12/07 =\r\n\r\n* Updated version.\r\n* Test with WordPress 5.3 version and Polylang version 2.6.7\r\n\r\n= 3.2.0 - 2019/09/26 =\r\n\r\n* Added setting section in \"TTfP Settings\" tab.\r\n* Updated version.\r\n\r\n= 3.1.1 - 2019/09/20 =\r\n\r\n* Fix file scanner.\r\n* Updated version.\r\n\r\n= 3.1.0 - 2019/09/13 =\r\n\r\n* Translate strings from functions: _e( string $text, string $domain = 'default' ) and __( string $text, string $domain = 'default' ).\r\n* Updated plugin description.\r\n* Test with WordPress 5.2.3 version and Polylang version 2.6.x.\r\n* Updated version.\r\n\r\n= 3.0.0 - 2019/05/12 =\r\n\r\n* Added import and export feature.\r\n* Updated plugin description.\r\n* Test with WordPress 5.2 version and Polylang version 2.5.x.\r\n* Updated version.\r\n\r\n= 2.0.4 - 2018/12/10 =\r\n\r\n* Test with WordPress 5.0 version and Polylang version 2.5.\r\n* Updated version.\r\n\r\n= 2.0.3 - 2018/07/04 =\r\n\r\n* Test with WordPress 4.9.5 version and Polylang version 2.3.4.\r\n* Updated version.\r\n\r\n= 2.0.2 - 2018/01/02 =\r\n\r\n* Updated plugin description.\r\n* Test with WordPress 4.9 version and Polylang version 2.2.7.\r\n* Updated version.\r\n\r\n= 2.0.1 - 2017/10/03 =\r\n\r\n* Test with WordPress 4.8 version and Polylang version 2.2.3.\r\n* Updated version.\r\n\r\n= 2.0.0 - 2017/03/05 =\r\n\r\n* Added plugin scanner.\r\n* Updated version.\r\n\r\n= 1.4.0 - 2017/01/29 =\r\n\r\n* Polylang version 2.1 - fixed: polylang changed default tab.\r\n* Updated version.\r\n\r\n= 1.3.3 - 2017/01/09 =\r\n\r\n* Test with WordPress 4.7 version and Polylang version 2.0.12.\r\n* Updated version.\r\n\r\n= 1.3.2 - 2016/09/07 =\r\n\r\n* Test with 4.6.1 WordPress version.\r\n* Updated version.\r\n\r\n= 1.3.1 - 2016/06/07 =\r\n\r\n* Added plugin logo.\r\n\r\n= 1.3 - 2016/05/15 =\r\n\r\n* Fixed warnings.\r\n* Test with 4.5 WordPress version.\r\n* Updated description.\r\n* Updated version.\r\n\r\n= 1.2 - 2016/03/27 =\r\n\r\n* Updated description.\r\n\r\n= 1.1 - 2016/02/03 =\r\n\r\n* Fixed readme.txt\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeneroi%2Ftheme-translation-for-polylang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeneroi%2Ftheme-translation-for-polylang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeneroi%2Ftheme-translation-for-polylang/lists"}