webpack2 i18n-plugin How to decide the bundle to load - internationalization

I have a working webpack config which can generate i18n bundles. I am using i18n-webpack-plugin. My website is a static website. I can see the bundles generated as [language].[name].bundle.js. eg: "de.login.bundle.js", "en.login.bundle.js".
Now in my login html page, how do I decide which of these bundles to load ? I will provide my users an option for language selection, say in top nav bar. Once user has selected it, how do I load the appropriate language bundle?

I found a solution to achieve this using HtmlWebpackPlugin :
new HtmlWebpackPlugin({
filename: language + '/login.html',
template: 'html/login.html',
chunks: ['login']
})
This generates separate Html files under each language directory eg: en/login.html, de/login.html. Now , based on the user's language selection, he can be redirected to appropriate URL.
I would still be interested to know if there's any alternate way to achieve this.

Related

Downloading swagger-documentation in the same style as displayed

I'm using the swagger-editor docker.
It produces, in the right column, a beautiful and functional interactive version of the documentation I'm writing in the right column.
I am trying to export such documentation but to no luck.
Is it possible to export an interactive, stand alone, documentation looking and working as the one shown in the right column?
The right-side panel of Swagger Editor is Swagger UI. You can download Swagger UI assets and host them on your own website.
Download (or clone) the Swagger UI repository:
https://github.com/swagger-api/swagger-ui
Take the dist folder - it contains the static assets.
Put your OpenAPI YAML/JSON file to the dist folder.
In the dist\index.html file, change the url parameter to point to your YAML/JSON file:
const ui = SwaggerUIBundle({
url: "myapi.yaml", // <----
Put the files from the dist folder on your web server.
It's also possible to embed Swagger UI into your existing web page, e.g. if you want to have your custom branded header and footer.
See also:
Is it possible to get an offline version of Swagger documentation for a website?
Swagger UI single interactive HTML

How to create a custom component for Joomla 3.3?

I'm new to Joomla and I'm confused, so I need your advice on this. I have to create a plugin which connects to an API and shows base64 PDF on a page. So, I created my PDF viewer, but I don't know how to pack it up in Joomla. It's not just "custom HTML", it has to be a separate package so it can be installed on other Joomla sites. I guess it also has to have a database to store some settings (e.g. API URL). I want users who install this extension to be able to go to Modules > New Module > PDF Viewer, and from there they can set up API URL for that module. Users will be able to create modules of this type on multiple pages and to be able to set different API URL for every page. So, what do I need? An extension, component, module...? I searched for tutorials and read Joomla docs but I'm still confused. Please help me, what to do, some guide, where to put files, where to upload them etc. Thanks
You could actually go about this with a component, plugin or module:
I think a component would be the most complex in this situation. As you are probably already aware, a component is like an application which renders itself in the main click of the website.
If you were to create a plugin, you could generate a short code snippet based on the name of the plugin which could then be added to an article, which would then display the PDF within the article. For example:
{PDFgen=NAME_OF_PDF}
or
{PDF}name_of_file.pdf{/PDF}
Creating a module in my opinion would be the easiest. As once you've added the functionality to render the PDF, the user can either display it as a module (like a sidebar widget), or they can also import it in their article using a built in Joomla feature. Assign a custom position to the module, then add the following anywhere within an article: {loadposition XXX}, where XXX is the name of the custom position you assigned to the module.
Out of all honest, you should develop it in a way you feel most comfortable with. Just make sure when you do it, that you stick to Joomla coding standards.
Hope this helps

Jenkins UI customization

I want to change the look and feel(ui customization) of Jenkins. Also I would like to add new views(say like new html pages or web pages) with navigation to the required jenkins pages etc.
Please let me know if any single plugins will help me to do so.Any relevant information(how ever generic) will be very helpful.
Any suggestions or links or tutorials is also appreciated.
PS:- Pretty new to jenkins.The inputs from here will help me to add more details to the questions.
I am looking for documents or tutorials that specify Skinning Jenkins using plugins like :-
https://wiki.jenkins-ci.org/display/JENKINS/Simple+Theme+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/jQuery+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/jQuery+UI+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/JSWidgets+Plugin
The plugin page is providing very little information on how to use these and the benefits and the extend to which the UI can be changed.
Any doc or link is appreciated.
Assuming you don't want to write a Jenkins plugin, for adding pages, the best suggestion I can make is to use an HTTP proxy such as NginX, and configure it so that the pages you want to add are plain html files, and Jenkins is proxied for the rest of them. To a visitor, they will look like they are all part of the same site; you could copy code from the head and body sections of Jenkins-served pages to include some of the navigation.
The Simple Theme Plugin, which you found, will let you do basic customization of the look and feel of Jenkins. I do that for my build server and proxy it using this configuration fragment for NginX. The relevant CSS is in this CSS file - toward the end, look for the // JENKINS CUSTOMIZATION comment.
We use the Simple theme plugin - pointed at a css file for the simple styling, and a JS file to fix a couple of DOM oddities (some of the tables in the new look and feel have mismatching column counts).
Those two files need only be hosted either a handy http server, or you can place them in usercontent.
You need only refresh the page in the browser to see the changes. Both files can then happily reference other files served up too.
Handy things to note:
Jenkins has jquery, parts of YUI loaded and prototype loaded - so you can use them in your scripts.
If while debugging, the refresh gets in the way then use the console to enter the following to temporarily stop it without pausing JS: refreshPart = function() {}
When making DOM tree changes to content that is refreshed - attach it to the layout updates with:
layoutUpdatecallback.add(my_function) - that way your changes are applied to new incoming content.

Port X-Cart Module to Joomla (Cloudsearch) (might be impossible)

I have an X-cart store with a Joomla front-end. I have installed the x-cart module cloudsearch into my x-cart store. It creates a little search box in the upper right corner to search my x-cart store's products and pages. I would like for this box to also appear in my joomla sites header (which is the "front-end" for the store). Does anyone know if this is even possible?
Thanks for any help
Sure, create a new module of type "Custom HTML" and paste your cart form there (if it's just ajax) or load it by url creating a module of type "Wrapper"
Ok, so this required finding the libraries for the module (mainly handlebars.js and hoverintent.js) and making sure those were being loaded via the joomla header. Also had to add CSS from the modules template directory as well. Then I used "view source" to get the generated javascript source to initiate cloudsearch, as well as get the dynamically generated html for the search box I was using.
Thanks to everyone who tried to help. In the end it ended up being just a matter of getting the javascript, css, and html right. All the database connectivity and search features are controlled by an external js file loaded from the cloudsearch server.

Joomla: Is there a querystring parameter that can remove a pages theme?

We've got a joomla website and are now in the process of developing a sencha-touch application to complement it.
Since our website is in joomla, I don't want to have to write any PHP to extract page data separate from the main site.
Is there any type of querystring parameter that can disable the theme?
IE:
http://example.com/about-us?show-theme=false
If this is not possible, is there any other option to achieve similar results?
index2.php is depreciated and is no longer supported in new versions of Joomla. What you are looking for is ?tmpl=component. You can add that to any Joomla URL and it will only display what you have coded in the /templates/YOUR TEMPLATE/component.php file. The default loads just the component output, but you can customize it to do what ever you want.
Do I get your question right: you want to extract the content from the page, without menu and so on? 2 possibilities, then:
Extract it from the concerning RSS feed (of the front page, of a category ... if you need more options you can install an component such as Total RSS
Use index2.php: example site (This doesn't seem to work if you use URL Rewriting as in your example URL.)
you can add format=raw in the URL. This will only output the content of the component and not the template.
This is used to show printable pages.
You may have to create a view.raw.php file along with the view.html.php

Resources