Which WPML method of string translation should I use? - content-management-system

I am trying to translate my WordPress website (built using Brooklyn theme) but I do not know which method to use to translate my strings. At first, the strings weren't showing up in the string translation search but then I learned that I had to add more code.
My first question is, do I have to go through every single page and custom CMS entry that I use to update content and wrap everything in code, or is there a way to do that automatically?
Secondly, I use Brooklyn theme but their support team is so slow so I wanted to ask if there was a standard way to find the theme's text-domain to include in the code (if I need it).
Thirdly, I know the options I have with which method to use to translate strings (manual registration or GetText) but I haven't found any explanation relating to where to put this code and how to implement it (even the official documentation gives you the code but doesn't explain what to do with it and I'm not a PHP expert!)
I'm using all the latest versions of WPML and the multilingual CMS.
http://www.expedition-polaris.com

Yes, you'll have to wrap all strings that you want translated with one of the localization functions ( https://codex.wordpress.org/L10n ) : __(), _e(), _n(), etc.
If you have already purchased the Brooklyn theme, then grep through the source for either _e( or __(, to find out the text-domain., or if you run the scan function via the String Translations admin page, the text-domain should be listed for the theme.

Related

What is the relation between extensions and the backend of TYPO3?

I am new to TYPO3 and have trouble understanding the general relation between extensions and the backend of TYPO3.
For example, is it true that the goal of making an extension is to be able add edited/new content elements to your page that cannot be found in TYPO3 out of the box?
For example if I wanted to add a carousel to my page, would I make an extension and design it in such a way that I can add it from my backend to the desired page? Or would it make more sense to, for example, put it as a partial and import it to the desired page using fluid (all of this without using the backend and just using code).
Or are both approaches possible and when would you go for the first or the second (or seek out a third approach)?
Sorry if this question is too general/vague. I feel like I do not understand how the backend and the files in my TYPO3 folder communicate to generate the website and that I am using content elements in the backend one time and typing out the elements in HTML the next time without a good reason for it.
I try to bring some light into the dark areas.
Backend This is the admin area of the CMS where in most cases the content is created by editors.
Frontend: How the website looks to a regular visitor
Extension: An extension is custom code, either your own code or by others which extend TYPO3 in one or more ways. The benefit is that you don't change the code of TYPO3 core itself and therefore it can be always updated.
An extension can be used for a lot of things:
- Shipping a site template with all the assets like CSS, JavaScript, HTML template, ..
- Providing custom content elements
- Providing new record types like news or forms
- Improve user experience
So yes, if you want to have a new kind of content elements you need to use an extension:
Search on https://extensions.typo3.org to check if there is already something which fits your needs
Use https://extensions.typo3.org/extension/mask/ (best in combination with https://extensions.typo3.org/extension/mask_export/) or https://extensions.typo3.org/extension/dce/ to make it a lot faster to create content elements
If experienced you can also create a custom content elements without any additional extension but for start I don't recommend that.
One approach to look at this question in a different way might be to differentiate between content created and maintained by editors (the backend users which typically add and maintain content) and parts of the visible webpages created in other ways. For example, the header, footer, menu of a site may be created by a sitepackage extension - this is something the editor (backend user without admin access) typically has no permission to access and that is one of the points of a CMS - the content is editable by someone without technical background. Of course this improves the stability as well because you don't have people fiddling around with things they should not be able to have access to and thus cannot break.
If you want your editors to be able to add (remove, change) content - do it in a way they have access to (typically using content elements).
You are right, the core provides content elements (such as "textmedia"), extensions can extend this by adding other content elements.
For your example with "carousel" you might want to look at the (official) Introduction Package which uses the bootstrap_package which offers a carousel content element. The Installation Guide explains how to setup a TYPO3 installation with "Introduction Package" so you may already be using that.
For example, is it true that the goal of making an extension is to be able to add edited/new content elements to your page that cannot be found in TYPO3 out of the box?
That is one of many, many other possible purposes of an extension. For example, look at the extension "min". It does not provide any content element and there is no visible change for the editor. An extension is just a way to extend the TYPO3 core (while the core itself also consists of extensions).
Introduction of Extensions in TYPO3 Explained
Sitepackage Tutorial

Using Moodle APIs to change strings in activity plugin

In my Moodle activity plugin I am trying to allow an admin to change strings from the settings of the plugin. The strings that should be changeable are: Teacher, Class and Student . These are used throughout my plugin.
.
I am currently attempting it using php constants and that is working.
I am undecided if this is the the best method as I am converting an old plugin and not sure what string APIs I could use for Moodle 3.5.
Should I just proceed with the current method as it is working ?
If you use the standard Moodle handling for language strings (i.e. store them in [plugin]/lang/en/[nameofplugin].php and retrieve them with get_string() ), then an admin can override them by visiting Site admin > Language > Customise language pack.
That would be the normal way to allow for strings to be modified by admins (which would also allow for the words to be correctly handled in contexts, e.g. having the correct gender for the displayed language, handling plurals, etc.)

Name input like SMS or Facebook app

I'm trying to find a library that can handle autocompletion with tokened (grouped) texts.
There are some very nice libraries out there for autocompletion such as:
https://github.com/EddyBorja/MLPAutoCompleteTextField
https://github.com/hoteltonight/HTAutocompleteTextField
https://github.com/TarasRoshko/TRAutocompleteView
The problem here is, I want to make the selection look like names tagging at SMS or Facebook app. So when the user tries to delete, he should delete all the text.
There are good jQuery implementations, one of them is this:
http://loopj.com/jquery-tokeninput/
I couldn't find any for iOS, perhaps the keywords are very generic, thus Google does not show any related results. Is there any library for this or can you provide any code examples?
What you're trying to achieve can't be done using the public SDK.
However, there exist some nice third party solutions.
I found this question, Is there an iPhone equivalent to the NSTokenField control?, which includes links to controls you could use.

Google Content Experiments for whole part of the site

I want to run an A/B-test or an experiment for whole part of the site. For example on my /blog/ page, where one variation would have a newsletter form and other variation a free ebook download button.
The problem is that I have to use a full URL path for the experiments, for example /blog/2013/article/1?var=1 and /blog/2013/article/1?var=2 With this method I would need create a new experiment for each blog post. This is impossible.
Any tips on how to approach this?
It's possible, but the documentation is lacking.
When you choose your variation URLs, you need to use relative instead of http://. This let's you use query parameters to define the variations, instead of the full URL. In your example, you would define your original page as:
http: //www.example.com/blog/2013/article/1
and your variation URLs would be ?var=1, var=2, etc. using relative as the option in the dropdown (instead of http:// or https://).
Here's the not-so-clear documentation on using relative URLs for your variations:
https://support.google.com/analytics/answer/2664470?hl=en&ref_topic=1745208
One important thing to remember is that if you're doing it this way, you need to include the content experiment code on every "original" page.
There's also another way to have even more control over serving the variation pages and controlling the experiment using the Content Experiments JavScript API. This is a relatively new feature - you can see the developer documentation about this here:
https://developers.google.com/analytics/devguides/collection/gajs/experiments
I am not sure this is possible. You might look at a more robust yet simple to use tool like Visual Website Optimizer or Optimizely.

GWT Dynamic String Internationalization

Can someone explain how to use this feature. i'm trying to search for an example on the web but not getting it. Also, if at run time, the user wants to change language, how to do so??
According to docs, you can
either specify "locale" GET parameter in your URL, for example:
http://www.domain.com/application.html?locale=fr_CA
or add meta tag to your host HTML page, for example:
You may find complete internationalization example here - it uses locale get parameter approach.
As far as I understand, there's no way to change localization without GWT module re-loading (see here for details).
Both these approaches are static. But for the dynamic approach, this is very hard. Based on the current user's locale, change the ui rendering is NOT that easy...
If any