https://github.com/mlocati/concrete5-integrated-localization
Stuff to integrate localization in the website
https://github.com/mlocati/concrete5-integrated-localization
Last synced: about 2 months ago
JSON representation
Stuff to integrate localization in the website
- Host: GitHub
- URL: https://github.com/mlocati/concrete5-integrated-localization
- Owner: mlocati
- License: mit
- Created: 2014-11-04T22:38:52.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-09T14:29:42.000Z (about 10 years ago)
- Last Synced: 2025-02-05T08:37:15.727Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 617 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
concrete5 Integrated Localization
=================================Work-in-progress project to integrate a translation system within concrete5.org website.
Available components
--------------------### Jobs
`Fetch git translations`
Fetches the two GitHub repositories and extracts translatable strings for all the tagged versions as well as for the development branches.
**Warning** the first execution of this job may require a few minutes. Subsequent executions will be much faster (it should complete in seconds).### Block Types
`Integrated Package Languages Builder`
For package developers: they can upload their package and download the language files for that package### User Groups
`Translations administrators`
Users belonging to this group will have global locale administration rights`Locale administrators for xx_XX` (where `xx_XX` is a locale identifier)
Users belonging to this group will have locale-specific administration rights`Locale translators for xx_XX` (where `xx_XX` is a locale identifier)
Users belonging to this group will have locale-specific translation rights`Aspirant locale translators for xx_XX` (where `xx_XX` is a locale identifier)
Users that want start translating a specific locale will be inserted in this group### Single Pages
`/integrated_localization/locales`
to manage locales (only for site administrators and for global locale administrators)`/integrated_localization/groups`
to view, join and manage translation groups`/integrated_localization/translate`
to view core and package translations, and to upload new translationsExample of importing package strings
------------------------------------```php
getPackageHandle(), "\n";
echo "Package version: ", $ipl->getPackageVersion(), "\n";echo "Importing/updating translatable strings... ";
$tsh = Loader::helper('translations', 'integrated_localization');
/* @var $tsh TranslationsHelper */
$tsh->saveTranslatables($ipl->getTranslatables(), $ipl->getPackageHandle(), $ipl->getPackageVersion());
echo "done.\n";
Loader::model('integrated_locale', 'integrated_localization');
foreach (IntegratedLocale::getList() as $locale) {
try {
$translations = $ipl->getTranslations($locale, true, false, false);
if($translations->count() > 0) {
echo "Importing translated strings for ", $locale->getName(), "... ";
$tsh->saveTranslations($locale, $translations, false);
echo "done.\n";
}
} catch (Exception $x) {
}
}
die('All done.');
}
catch(Exception $x) {
die('Error: '.$x->getMessage());
}
```