Comments (2)
Headers are added in the Translations
instance.
$translations->getHeaders()->set('key', 'value');
And then you have to pass the translations instance to the Po generator:
$poGenerator = new PoGenerator();
$poGenerator->generateFile($translations, 'locales.po');
from gettext.
Headers are added in the
Translations
instance.$translations->getHeaders()->set('key', 'value');
And then you have to pass the translations instance to the Po generator:
$poGenerator = new PoGenerator(); $poGenerator->generateFile($translations, 'locales.po');
Thanks. Thanks to you I can make it work like this.
foreach ($phpScanner->getTranslations() as $domain => $translations) {
//seems to work, but po file does not seem to have the "language" header
$translations->setLanguage($domain);
$dosya_yolu = 'locales/' . $domain . '.po';
$translations->getHeaders()->set('Last-Translator', 'Mehmet Bozkurt');
if (file_exists($dosya_yolu)) {
$mevcut_translations = $loader->loadFile($dosya_yolu);
$updatedEntries = $translations->mergeWith($mevcut_translations);
$generator->generateFile($updatedEntries, "locales/$domain.po");
} else {
$generator->generateFile($translations, "locales/$domain.po");
}
}
from gettext.
Related Issues (20)
- Update Documentation HOT 1
- Feature Request: WordPress gettext functions support for scanner HOT 2
- testMoGenerator fails HOT 2
- Why PHP >= 7.2 for Gettext v5? HOT 1
- How to load multiple *.mo files (general and for specific textdomain) HOT 3
- Plural parsing for MO files appears to ignore Plural-Forms HOT 2
- Gettext doesn`t extract template literals from JS HOT 1
- PHP 8.1 compatibility: warnings about JsonSerializable compatibility
- Make use of msgctxt HOT 1
- translations findById HOT 2
- Handling of defective .po files HOT 4
- PHP functions prefixed with a slash are being ignored HOT 3
- add a ?? to string reader for php8.1 in /src/Utils/StringReader.php HOT 2
- what is the equivilent of v4 Gettext->register() in v5? HOT 5
- [question] How to store arbitrary key-value payload in Translation objects, now that it can no longer be faked using references? HOT 1
- Scanner for WordPress (provided repo link) HOT 1
- [Question] Simplest way to promote items in a Translations object to a subclass? HOT 1
- How do I configure to scan files for my own custom funtions HOT 1
- PHP 8.3 Support HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gettext.