Can I easily override the translation of a word in my Concrete 5.7 theme? - concrete5

Is there a way to easily override the translation of a word or phrase as produced by the t() function throughout the Concrete5 settings pages/dashboard, without altering core files?
For example, if several core files use this code:
<?= t('Empty Auto-Nav Block.') ?>
Can I somehow override this and specify my own translation without producing another whole language file?

This does not appear to be easily possible.
Concrete 5.7 uses Zend Translate, and others on S.O. have asked about creating overrides for this (see override gettext .mo files).
If you only need to override a few words from the default US language, you can:
Create a custom MO file using a tool such as POEditor.com, including just the words/terms you want to override
Save the .mo file to /application/languages/[LANGUAGE-CODE]/LC_MESSAGES/
Enable your new language file via C5 Dashboard > Settings > Basics > Languages
However if you need to override words from another language, it looks like you might have to create your own custom PO/MO files that contains the entire dictionary. You can probably import an existing one from the official c5 translations repository on Github.
This appears to be a major limitation of the Zend Translate library.

Related

Robot Framework resource and library file difference

What is the difference between resource and library file in robot framework?
I searched google but couldn't able to find the answer
The resource file content is in the Robot Framework syntax. When it's imported in a suite, you can use all its keywords and variables, defined in the corresponding sections. Also all its imports (other Resource and Library it defines in the Settings section) are now available for usage.
The libraries on the other hand are (usually) written in the Python language. They can be ones installed through pip, or standalone scripts or modules. In the simplest case, all public functions of a module (more specifically - not-hidden) are available as keywords to be used in the suite. For more advanced usage (scope, state upkeep), they have to follow specific structure (usually accomplished through classes, and using identifiers/decorators expected by RF).
There is a third type of import, for which you haven't asked but I'm adding for completeness - the Variables files. Their format is once again Python code, which makes them quite versatile and powerful compared to vars defined in RF syntax (you can set the variables' content through complex programming constructs).
One caveat to keep in mind with them - the framework expects every attribute of the module to be a variable, and makes it accessible in your suite; this includes even other modules the file imports :). Thus you have to hide them through the _ name suffix (or, abuse this side effect for silent imports in some exotic cases :)).
I've included links to the relevant sections of the user guide, for further information.

What would be the best method to use LaTeX as a template?

I have a need to have a PDF document that has a very specific format. I have data that is in a Meteor 1.0 application stored in MongoDB. How can I use a LaTeX template in place of an HTML template?
I have a number of Meteor packages where I have repackaged JS libraries and written complete packages. I know how to do that.
I don't wish to use HTML for the output because I need the output to be very exacting. I can achieve that with LaTeX. What I am unsure of is how to use LaTeX as the template and inject data into the document before processing and ultimately printing.
Meteor is at 1.0.
On this version things changed a lot. You have to choose the packages that you want to use.
According to the documentation:
Since the parts of the stack integrate seamlessly, if you don't want to think about how it all works, you don't have to. You don't have to understand that the platform is made up of Blaze, Tracker, DDP, Livequery, and Isobuild, or how these pieces fit together. But if you want to dive in and learn how the parts work, you can do that too, because they are independent projects.
So you can code a meteor application without using Blaze. Check the meteor website for more information on this: https://www.meteor.com/projects
If you want to use Blaze (normal choise), you can get to know it better at https://docs.meteor.com/#/full/blaze
and you can adapt an existing LaTeX to HTML convert and create a template dynamically.

How to add a new language to Plone

We need a way to classify pages or files as being of a language not already known in the standard language list in Plone/Zope. We don't need any translation or other functionality, just a way classify items as these new languages.
What is the best practice way of handling this?
We are currently looking at using ATVocabularyManager to import a new list of languages and then creating a plugin that uses schemaextender to adjust the vocabulary used by the DC metadata language field on all Plone content. Is there a more out of the box way of doing this?
Some of the languages we want to add don't have standard language codes such as Koori, Assyrian, SoranĂ®, Tetum, Dari and Karen.
We also have a similar but related need to display Chinese Traditional and Chinese Simplified using these names, rather than as Chinese China and Chinese HongKong.
Similar to Add new language in Plone , the best way is to contact the i18n-team for adding a new language, even if you don't have translation-strings, yet. They can be contributed step-by-step and in case also be overwritten for individual purposes.

Translate QT application without text in code

Is there a way to translate a QT app into different languages without defining the texts directly in the source? I want to separate the text from source. This would result in some kind of resource files for ALL languages, including the default language (e.g. English).
You won't be able to leave the English (or your source language, not necessarily English) source out of the XML (.ts) files as lupdate will put it there each time you run it. However as long as a translation exists for the chosen language, the source text will be ignored. If there is no translation text, it will default to the source text. This is useful since you'll be guaranteed to get some sort of text in your translation, but it'll be up to your test team to insure that the translations exist. I wrote a python script to automate the checking of the translation files since we have 9 languages and nearly 1k strings per translation. To test for this, we used a very simple sed script to create pseudo-loc source strings so if there were translations missing, the pseudo-loc text would be very evident.
Regarding the process for editing the .ts files, we farmed out the translations to individual translators, providing them with the .ts file for their language, and usually about an hour's worth of hand's on instruction in using QT Linguist. If the translator was onsite and wanted to see their translations on our device immediately, I wrote an autorun script that would place the resultant .qm file in the right place in our embedded file system and restart the application to display the new translations. If they weren't onsite, we'd run them through the python script mentioned above to check for a number of different problems, then simply check in the .ts file so it'd get built the next time around.
HTH
You might be able to use the QT_TRANSLATE_NOOP family of macros to do what you want. Those simply mark some text as "need to be translated" so that lupdate picks it up, but you can refer to those translated values by variable constants in your code. So ...
const char *kHelloWorld = QT_TRANSLATE_NOOP("SomeScope", "Hello world");
Later...
return qApp->translate("SomeScope", kHelloWorld);
This is still in your source code somewhere, but it is at least one step removed. You could theoretically have the QT_TRANSLATE_NOOP stuff in an entirely different Qt project, but then you'd need some way in your real project to know what you are supposed to translate. (You still need the char* constants somewhere.)
What are you trying to accomplish exactly by not having the English text in the source? That might help people provide more appropriate answers.
EDIT
Based on your comment below about intended usage
OK, then this is precisely what the normal Qt translation process does. Running lupdate creates those XML files (they have a .ts extension). They can be opened by translators in the very-easy-to-use Qt Linguist. They are translated, then sent back to you (the programmer), where you run lrelease on them to create the binary translation files you will ship with the app. The translations are resolved at runtime, so there is no need to recompile.
If you wanted to enable a user to do this, you would:
Ship your application with an empty (untranslated) .ts file and the lrelease program.
Provide instructions on how to use Qt Linguist to translate. (They could use a text editor and modify the Xml directly, but it's a lot easier with Linguist.)
Explain how to run lrelease and where to drop the binary translation files so that your application pulls them in.
On this last step, you could theoretically provide a nice wizard-like app that hides the implementation details.
What we will do is:
* Include a translation for the former default language. Using this *.ts file to auto-generate the other *.ts files. This is required as we keep the translations outside the QT environment as they match with other projects not related to QT.
Then have only have to make sure this translation contains the correct value.
In the future we can define IDs in the code witch represent Text in the default translation. Like translating TXT_ID_ABOUT to "About".

Use an excel template and update it programatically

I found this tool but I wonder if it still the right way nowdays with net 4.0 or is there any straight forward oob alternatives.
I just need to add columns and update excel stuff programatically. There are many ways but I need to keep the original document as a template. The link above explains exactly what the requeriments are and why they created such "ExcelPackage" library.
A quick look at the link you provided seems like it will in fact keep the original template intact and just return a populated version of that template. This is a pretty common way to create and populate Excel documents using Open XML since it helps to minimize the amount of code you have to write. If you did not specify the layout, styles, formats, etc in a template you would be forced to define those when coding and that could lead to some bloated code. Overall, a project like this or using the Open XML SDK 2.0 to create the documents is the way to go.

Resources