Apache Rewrite mode. Rewrite Rule - mod-rewrite

Links
http://example.com/en/media/.../img.jpg
http://example.com/en/media/.../style.css
http://example.com/en/media/.../script.js
http://example.com/en/media/.../file.pdf
http://example.com/en/media/.../file.doc
and other extensions...
I need to check extensions (jpg|png|css|js|doc) at the end of query string and remove language (Part beetween http://example.com/ and /media/). I dont know how much and which specific symbols it will have.
en (En, English, En-en, En.en)
ru (Ru, Russian, Ru-ru, Ru.ru)
http://example.com/media/.../img.jpg
http://example.com/media/.../style.css
http://example.com/media/.../script.js
http://example.com/media/.../file.pdf
http://example.com/media/.../file.doc

Related

UK License Number RUTA entity extraction

I have been developing a proof of concept of free text analytics. The RUTA scripts which I have developed for account number, date, salutations, addresses, pin codes, name seem to work properly.
But I am stuck on one rule where I want to extract the license number in UK format from a textual paragraph. The rule I developed seems to work properly when it is alone passed as input but for some reason it fails in a text.
Any help would be highly appreciated as I have been with this issue for quite sometime.
PACKAGE uima.ruta.example;
DECLARE VarA;
DECLARE VarB;
DECLARE VarC;
W{REGEXP("^(?i)(a-z){2}") -> MARK(VarA)}
NUM{REGEXP("..") -> MARK(VarB)}
W{REGEXP("(?i)(a-z){3}$") -> MARK(VarC), MARK(EntityType,1,3), UNMARK(VarA), UNMARK(VarB), UNMARK(VarC)};
The format which I am expecting is
C - Character
N - Number
CCNNCCC
CCNN CCC
Your question(or problem) is not totally clear for me. Also the example script doesn't work (EntityType is not declared and the regular expressions are not valid).
I made an example script. Maybe that will help you:

Generate table of all main languages

I have to create a list with all languages which should look like this:
Col 1 | Col 2
-----------------
English | English
German | Deutsch
French | Français
Spanish | Español
...
Col 1: Language in English
Col 2: Original Country Language
The list should cover all main languages (or in other words: all languages which you can translate in google translator)
Of course this takes quite a while.
Is it possible to generate this list with a script by using the Google API ?
Yes, google has a Translation API which is very similar to the Google Translator. There are a couple of endpoints which are of interest to you in this case.
There is a way to list all the available languages, which would populate your Col 1. By default, this returns all the language (and sometimes language-country) codes that are supported, but you can provide a target query parameter to also include the name of the language in a "target language". In your case, you would want to show it "en-US".
In theory, you could repeat this for every language code and then just use the result for the language's own language code to populate Col 2. (This may be the most accurate way, but you'll get back a lot of extra data you don't want.)
Of course, you can also just translate the text to get your Col 2 results.

Magento: Decimal Price in spanish language display Dot instead comma

i have multilanguage store. default language is english. there are few products have decimal price.
when i switch languge to spanish the comma appears instead dot in decimal price.
for example: price: 1.35$ in english when i switch language to spanish the price will look like Price: 1,35$
i really wanna remove this , need . how to do that.?
You could try to change the local settings. So go to your magento directory and open the file lib/Zend/Locale/Data/en.xml (replace en.xml by the language file for which you would like to perform your changes).
Search for
<numbers>
<symbols>
<decimal>.</decimal>
<group>,</group>
Clear the cache, also for safer side please try to do this first on your test installation to avoid issues.
You can change your locale setting
here is example for English. For that you have to do Minor changes in your Language File. >Following is the Directory Structure of File.
=> root/lib/Zend/Locale/Data/en.xml (For English Language)
=> around line 2611 you can see following code.
> <currencyFormat>
> <pattern>¤#,##0.00;(¤#,##0.00)</pattern>
> </currencyFormat>
=> Now Change above code with Following code.
> <currencyFormat>
> <pattern>#,##0.00 ¤;(#,##0.00 ¤)</pattern>
> </currencyFormat>
you can set it to for Dutch.
To fix the comma form 1.000 to 1,000
add to the past post the following :
go to: => root/lib/Zend/Locale/Data/XX.xml (XX.xml For your Language)
for example : => root/lib/Zend/Locale/Data/en.xml (For English Language)
around line 2286 you can see following code :
<numbers>
<defaultNumberingSystem> xxx your Language xxx </defaultNumberingSystem>
<symbols>
<decimal>,</decimal>
<group>.</group>
to :
<numbers>
<defaultNumberingSystem> xxx your Language xxx </defaultNumberingSystem>
<symbols>
<decimal>.</decimal>
<group>,</group>
this wil change the comma form 1.000 to 1,000
thanks & regards
Bahattab

Change Magento decimal field format

I need to change Magento's default decimal format. I mean, when I save '1' to a decimal field, it becomes '10000.0000' with this '.0000' in the end.
I need to change it to another format, which uses ',' instead of '.' to separate decimal (and currency) numbers.
This is the Brazilian standard and it's not being used even after changing the store language. This change should be reflected mainly in the admin side.
Thanks a lot!
==Edited==
I haven't solved the problem yet. I'm using PT-BR (Brazilian Portuguese) as default language and it still using the wrong decimal character.
It seems Magento have some not-localized price formatting (I mean, hard-coded) in a few points of code. For example: magento\js\prototype\validation.js at line 426 have:
|| (!isNaN(parseNumber(v)) && /^\s*-?\d*(\,\d*)?\s*$/.test(v));
but instead it needs to be
|| (!isNaN(parseNumber(v)) && /^\s*-?\d*(\,\d*)?\s*$/.test(v));
to fit into PT-BR format (or other locales to).
Am I right? Does anybody could fix this issue?
if you want to check in admin area for this change
you go to in admin left bottom drop down
and select
Português (Portugal) / português (Portugal)
it will show you currency as you want. Also if you doesn't install you package go to
http://www.magentocommerce.com/translations/list/19
download your package and add it to your
locale folder and select from configuration for front end also
hope this will sure help you.
I've applied the following change to the file magento\js\prototype\validation.js (line 426):
|| (!isNaN(parseNumber(v)) && /^\s*-?\d*(\,\d*)?\s*$/.test(v));
and also, changed the file lib/Varien/Data/Form/Element/Abstract.php by adding the first if statement:
public function getEscapedValue($index=null)
{
$value = $this->getValue($index);
if(is_numeric($value)){
$value= number_format($value, 3, ",", ".");
}
...
this changes have solved the problem so far. Do you see any side-effect?
Comments are welcome! Thanks!
Newer versions of Magento are based on Zend Framework currency locale format so the best way to do this is to change the language.xml from the Zend directory, more information is on this great article.

What does 'Language neutral' mean with regard to MAKELANGID?

The docs for MAKELANGID specify that MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL) Means 'Language neutral'.
This seems to be English on my machine (tried it with FormatMessage), but what does it mean in general? Is it guarenteed to be English?
Thanks!
I would expect that this means that the strings associated with the lang id are not specific to any language - which could be useful to know for a localisation team. "%1 + %2 = %3" would be an example of one such string.
with sublanguage = SUBLANG_DEFAULT this would be the user's default language.
https://web.archive.org/web/20100704043524/http://msdn.microsoft.com/en-us/library/ms534732(VS.85).aspx
Here's a note on the sublanguage identifier - https://web.archive.org/web/20100728153356/http://wiki.winehq.org/SublangNeutral.
Note that MAKELANGID creates a language identifier for you from the primary language and sublanguage identifier - it does "not" get the default language, or anything like that.
No, it is not "gauranteed to be English." It "is" whatever you place into it at that point (English, in your case). But it means that it should not serve as a (language) satellite assembly (except maybe as a fallback).

Resources