Step to translate Joomla component - components

I've created an administrator component for Joomla 2.5 recently (in French), and not knowing how to proceed to translate it in English and German, I was wondering if someone could help me understanding the process.
Indeed, I think I understood that I need to format my strings such as :
JText::_( 'mystring' )
Then that I create .ini files, but I don't know where to create them, what they should contain, if it exists a tool like PoEdit that could suit etc. So if you have any idea how I should proceed...
Thank's guys !

In the "language" directory at the root of your website, you create the directories and files :
administration/language/en-GB/en-GB.com_yourcomponentname.ini
administration/language/fr-FR/fr-FR.com_yourcomponentname.ini
administration/language/de-DE/de-DE.com_yourcomponentname.ini
You translate each of them. I am not sure, you need a tool to do that.
And I don't know if it exists a PoEdit plugin to help you to do that too...
Your ini files look like the others that already exist in the language directories :
COM_ADMIN="Informations système"
COM_ADMIN_ALPHABETICAL_INDEX="Index alphabétique"
COM_ADMIN_CACHE_DIRECTORY="(Répertoire cache)"
Then in your views, to call a translated string :
JText::_( 'COM_ADMIN' )
This function will look for the value of COM_ADMIN in the ini file.
The loaded ini file will be the language the user has chosen, and if a translation doesn't exist, then it will load the value of the default language (chosen in administration panel).
Then if this key doesn't exist in any of these ini file, they the key is displayed.
To package your archive :
In install.xml, add these lines :
<administration>
<!-- Directory and file stuff -->
<languages folder="language/admin">
<language tag="en-GB">en-GB/en-GB.com_yourcomponentname.ini</language>
<language tag="fr-FR">fr-FR/fr-FR.com_yourcomponentname.ini</language>
<language tag="de-DE">de-DE/de-DE.com_yourcomponentname.ini</language>
</languages>
</administration>
And add the translation files in the language/admin directory.

Related

In Windows Node.js fs.readdirSync With Users Folders etc

I've been developing an nw.js project and use node.js file system functions in it as normal. In my application there is a file manager and I list folders and files according to user navigation. In Windows, for example, if I scan drive C: I get the Turkish named folder "Kullanıcılar" as "Users". I know it's real name in operating system is "Users" and just seen on the screen according to Languages. I can replace names of such folders when dispaying in my file manager but I'm searching for better solution if exists. Thanks in advance.
There's an SO answer here that reads the localized name of a folder in C# using the SHGetFileInfo function which might help you along.
Now I know you didn't ask, but in case you want to know where the information is stored... It's within the directory, in the Desktop.ini file.
For instance, my Windows 10 installation has this in it for "Users":
[.ShellClassInfo]
LocalizedResourceName=#%SystemRoot%\system32\shell32.dll,-21813
And this for the Images folder within my user folder (bringing this up to show you the additional keys):
[.ShellClassInfo]
LocalizedResourceName=#%SystemRoot%\system32\shell32.dll,-21779
InfoTip=#%SystemRoot%\system32\shell32.dll,-12688
IconResource=%SystemRoot%\system32\imageres.dll,-113
IconFile=%SystemRoot%\system32\shell32.dll
IconIndex=-236
The #%SystemRoot%\system32\shell32.dll,-21813 points to having to read the MUI (multilingual user interface) resources, key 21813 for the given file (presumably the # means that it's in this file, not this literal value, but don't quote me on that). %SystemRoot% is an environment variable that points to the Windows directory.
The actual MUI files and their locations are handled by Windows (see the MSDN link above), but we'll just happen to handily know that the MUI file for the US English localization of shell32.dll is system32\en-US\shell32.dll.mui.
Opening up that file with Resource Hacker, we can search for 21813 -- and voila! We can find STRINGTABLE resource #1364 that contains:
[...snip...]
21812, "Extras and Upgrades"
21813, "Users"
21814, "Saved Games"
[...snip...]
I unfortunately don't have tr-TR/shell32.dll.mui available, so you'll just have to trust me that you'd find the Kullanıcılar string there.

How to make proper module translations in Drupal 8?

I have to prepare modules translations, but the documentation is not helping me.
I know i can use *.pot files, but i can't fully understand how dupal is managing translations.
If i add translations/example.pot drupal will take care of everything else?
First modify module_name.info.yml add:
'interface translation project': block_example
'interface translation server pattern': modules/examples/%project/translations/%language.po*
Then create in your module directory folder translations.
Add translations/language.po files, where you will store translations.
language.po:
msgid "your id to translate"
msgstr "translations test"
template.html.twig:
<p>{% trans %}your id to translate{% endtrans %}</p>
Then go to your Drupal admin page Configuration/User interface translation, there you can filtr your msgid and see already translated files.
You may have to use IMPORT {just upload .po file}
Translations are imported automatically when you install your module.

How can I tell what language a file is written in?

I've been trying to find, for a long time, what language this file is written in so that I can decompile it. I have tried to decompile as .luac, .class and also tried to open it as .jar and .rar and .zip.
Although the file extension is .car I have never seen this extension before and there certainly aren't any openers for it on the internet. I have even gone to the point of finding a .car opener, but it wasn't for my .car.
So, I suspect it has just been renamed.
Can anyone tell me what language it is coded in?
I don't know if I'm allowed to post files here, as I have only just joined, but here is a Dropbox link to the file: https://www.dropbox.com/s/y6jd62lfywoskqi/code.car?dl=1
Any help would be appreciated. This is the first line in Notepad++:
rac T D ` constants.lu œÂ tools.stashsaver.lu à scenes.sellitems.lu ˆî scenes.draw.lu ¼ gui.menu.lu 6 scenes.missions.lu ˆP
A quick dump of the file leads to several URLs referencing:
http://www.coronalabs.com/
So based on this I'd say the file was created with the SDK they offer.
https://coronalabs.com/products/corona-sdk/
Corona lets developers use integrated Lua, layered on top of
C++/OpenGL, to build graphic applications. https://en.wikipedia.org/wiki/Corona_%28software%29

In Puppet using Hiera, where do I put the files I want to have installed on nodes?

I know puppet modules always have a files directory and I know where it's supposed to be and I have used the source => syntax effectively from my own, handwritten modules but now I need to learn how to deploy files using Hiera.
I'm starting with the saz-sudo module and I've read the docs but I can't see anything about where to put the sudoers file; the one I want to distribute.
I'm not sure whether I need to set up a site-wide files dir in /etc/puppetlabs/puppet and then make subdirs in there for every module or what. And does Hiera know to look in /etc/puppetlabs/puppet/files/sudo if I say, source => "puppet:///files/etc/sudoers" ? Do I need to add a pathname in /etc/hiera.yaml? Add a line - files ?
Thanks for any clues.
My cursory view of the puppet module, given their example of using hiera:
sudo::configs:
'web':
'source' : 'puppet:///files/etc/sudoers.d/web'
'admins':
'content' : "%admins ALL=(ALL) NOPASSWD: ALL"
'priority' : 10
'joe':
'priority' : 60
'source' : 'puppet:///files/etc/sudoers.d/users/joe'
Suggest it assumes you have a "files" puppet module. So under you puppet modules section:
mkdir -p files/files/etc/sudoers.d/
Drop your files in there.
Explanation:
The url 'puppet:///files/etc/sudoers.d/users/joe' is broken down thus:
puppet: protocol
///: Three slashes indicate the source of the file is in a module.
files: name of the module
etc/sudoers.d/users/joe: full path to the file within the module's "files" directory.
You don't.
The idea of a module (Hiera backed or not) is to lift the need to manage the whole sudoers file from you. Instead, you can manage each single entry in the sudoers file.
I recommend reviewing the documentation carefully. You should definitely not have a file { "/etc/sudoers": } resource in your manifest.
Hiera doesn't have to do anything with Files.
Hiera is like a Variables Database, and servers you based on the hierarchy you have.
the files inside puppet, are usually accessed in methods like source => but also these files are using some basic structure.
In most cases when you call an file or template.
A template can serve your needs to automatically build an sudoers based on that.
There are also modules that supports modifying sudoers too.
It is up to you what to do.
In this case, saz stores the location of the file in hiera, but the real location can be a file inside your puppet (like a module file or something similar).
Which is completely unrelated.
Read about puppet file server
If you have questions, just ask.
V

Using a Twig Extension

I am trying to use teh Twig i18n Extension.
As far as I can tell the file I need is here:
https://github.com/fabpot/Twig-extensions/blob/master/lib/Twig/Extensions/Extension/I18n.php
Now I am not quite sure where to save this file
I have Twig in a folder called includes/lib (/includes/lib/Twig). I see a folder Extension under Twig. Do I save it here?
After I save it, do I need to do a "require_once" to the file or will Twig_Autoloader do the job for me?
I am not using Symfony2
Thanks
Craig
Here is the complete answer that worked for me:
Copy the file in Twig-Verzeichnis (extract i18n.zip in Twig).
For the I18n extension it would be Twig/Extensions/Extension/I18n.php
Eventually add other files requred by I18n. You will see what these are by the error messages that come. I had to add "Twig/Extensions/Node/Trans.php" and "Twig/Extensions/TokenParser/Trans.php".
In your config file add the following:
// Set language to German
putenv('LC_ALL=de_DE');
setlocale(LC_ALL, 'de_DE');
// Specify location of translation tables
bindtextdomain("project_de_DE", "./locale");
// Choose domain
textdomain("projectl_de_DE");
Register the Twig Extension
$twig->addExtension(new Twig_Extensions_Extension_I18n());
Create the directory locale/de_DE/LC_MESSAGES
Create the PO file (the easisest is to have a sample file to start from)
Open the file in a normal text editor (be sure to use utf-8 encoding) and start translating
Open the PO-Datei with PoEdit (www.poedit.net/)
Save to locale/de_DE/LC_MESSAGES (a MO-Datei will be created).
Add the translation to the appropriate places in the Twig-Template with
{% trans 'Text in the original language' %}`
You need to register this extension with Twig:
$twig->addExtension(new Twig_Extensions_Extension_I18n());
If your installation is configured correctly, the autoloader should do the job of including the file. If not, you could include the file manually or make the installation with composer.
It seems the "proper" way to install these extensions without Composer is as follows:
Download a release from https://github.com/fabpot/Twig-extensions/releases
Copy the contents of the lib/ directory somewhere to your project
include the file .../Twig/Extensions/Autoloader.php
Register autoloader: Twig_Extensions_Autoloader::register();
Continue as explained in the doc: http://twig.sensiolabs.org/doc/extensions/i18n.html

Resources