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.)
Related
I have a website hosted on AEM. I want to change a text that is present in almost all pages (say I want to change my product name which is present in all pages) . How can i do it. It can either be a Groovy/Java code or an ondeploy script or anything else. Because doing it manually on all pages at multiple locations is not feasible. Will AEM Bulk Editor solve the purpose?
Its like Find and replace functionality in office
Yes, you will need to have a set of queries to find most of the references and then make a POST to these pages with the new value.
Example with: curl -u $USER:$PASSWORD -F"PROPERTY=new value" "http://$HOST/content/mysite/en/page/jcr:content"
Of course, you can do it with Java, Groovy (look for Groovy Console for AEM, which is very convenient), or even bash for simpler cases.
You can write a query using the query builder api to get all the nodes where your particular property is present.
Then once you get the path to that property you can update that using the node api.
Currently I work an an app where the user can create products for a catalog. The status is, he can do this in one language, data gets send to the backend and saved. The next step would be to make this creation process ready for multiple languages e.g. english or french. The behaviour should be the following, he choses the language inside a drop down field and gets a form in the selected language.
The problems I encountered and my solution process till now:
1) How should the view handling be? Should I create a new fragment for every language and exchange the content? If Im correct that would mean I would need to destroy and create fragements for the languages, right? And then create them with a binded model again.
2) How should I handle the model/models? Should I create one model with the data they share e.g. creation date and create a model with language related attributes? That would be my solution right now.
Maybe you already did something similiar or have some thoughts about this, thanks for any help!
You should do neither of those things. There are mechanisms in place, generally referred to as i18n that help you with this process. UI5 help available here:
https://ui5.sap.com/sdk#/topic/df86bfbeab0645e5b764ffa488ed57dc
and
https://ui5.sap.com/sdk#/topic/5424938fc60244c5b708d71b50a0eee4
In summary, translations should be done using the i18n mechanisms and the oData logon language.
Logging into the application, assuming it's hosted on an SAP gateway or SCP / Launchpad, the user's current logon language will drive at least all standard SAP translatable texts like the labels returned from data elements in your oData services. The appropriate url parameter is sap-language=EN, but it's set automatically from the current browser settings. Generally, you don't have to worry about this.
The same browser settings drive which particular i18n file is loaded. This could be specific like en_US for American English, or fr for French.
If you code your app without any hard coded translations but always follow the rules in the links above, adding a language should be trivial.
These translations could probably be triggered programmatically via a dropdown as well but I have never tried that since it's extra steps for my users.
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.
I'm developing a multi-lingual site.
I've put a Zend_Translate object in the Zend_Registry and I use it to translate all static texts to the selected locale.
My question is how do I change the locale when the user chooses another language?
If I get the translate object from the registry, call setLocale , and put it again in the registry , will it hold only for that user or for the whole application?
Thanks.
You will need to use a plugin for that.
In short: create your plugin and add the routeStartup() and routeShutdown() methods to it. In the former one, set the locale string in a request param and, if needed, also set the requesr URI to contain the locale string. Correct locale string detection is up to you - you can either use a cookie, URL parametre, browser's accepted language header or any combination of the three. In the latter one, create your Zend_Translate object based on the locale you have set earlier.
Here is how it looks like in my CMS.
Here is a tutorial regarding the use of the language parametre in the URL. You may also check how I do it in my CMS (see the _initRouter method).
I hope this info is helpful.
Use Poedit for this purpose ..go thru this link for more
techie.ayyappadas.com/how-do-use-poeditor
I'm using symfony 1.4 for my web project.
I have the following problem (or opportunity): I need to create a calendar where the "common" user has only the ability to see (or read) the date and time of the events and the "admin" user can edit, add and remove new events. So it's basically a google calendar type of thing where I have to different permissions, read and read, write, delete.
Also I need to be able to fully customize a calendar style so that It matches my css.
How would your approach this problem? I've been trying to find the best plugin for this endeavor but I haven't found one that with a good documentation
Thanks in advance!
I recommend FullCalendar jQuery plugin. It gives you very nice JavaScript calendar with drag&drop support. You can use your own CSS style.
On the server side create symfony actions that will return data to FullCalendar API. Just serialize the data to JSON Event Object.
Of course you should use symfony security component to restrict read/write access. Show only those events that users should be able to see. And don't let them access write actions if they don't have write permission.
To manage event data you can either create backend admin module or display your own form when user click on calendar (like Google Calendar does). If you like the second approach then you have to handle it in JavaScript.
I would suggest to build 2 applications for that.
frontend (read/see)
backend (admin)
Just go with the normal symfony approach.. define your models, generate frontend (inkl. modules). There you can adjust you templates and css.
Practicle open book where you can choose the topics you need
Then use the admin-generator to get the backend application. You can customize behaviours and styling of course.