{"id":420,"date":"2012-07-16T23:40:56","date_gmt":"2012-07-16T23:40:56","guid":{"rendered":"http:\/\/blog.mozilla.org\/l10n\/?p=420"},"modified":"2012-07-16T23:40:56","modified_gmt":"2012-07-16T23:40:56","slug":"tips-tricks-cleaning-up-narro-exports","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/l10n\/2012\/07\/16\/tips-tricks-cleaning-up-narro-exports\/","title":{"rendered":"Tips &#038; tricks: Cleaning up Narro exports"},"content":{"rendered":"<div id=\"magicdomid2\">If you&#8217;ve ever used Narro to localize a project, you may have spent time cleaning up your exported files before they are committed to your locale&#8217;s repository. If you don&#8217;t catch the errors within your Narro export, you&#8217;ll find that some files may be reverted or corrupted in other ways that can ultimately break your localization. On the other hand, cleaning up these exported files can require some time and smooth hacking skills.<\/div>\n<div><\/div>\n<div>While these Narro bugs are being fixed, here&#8217;s a work around that you can easily use to make sure that your L10n work is squeaky clean before it goes into your locale repository.<\/div>\n<div><\/div>\n<p>First we&#8217;re gonna update your local, cloned repo by running the following commands from your local directory:<\/p>\n<blockquote>\n<pre style=\"font-size: 100%;\"><code>hg pull<\/code>\r\n<code>hg update -C -r default<\/code><\/pre>\n<\/blockquote>\n<p>Then, select, drag, and drop the Narro export into your updated repo.<\/p>\n<p>Now that you have your export in your local directory, review the file status by using this command:<\/p>\n<blockquote>\n<pre style=\"font-size: 100%;\"><code>hg status<\/code><\/pre>\n<\/blockquote>\n<p>Running this command will display what files in your local directory have been modified, added, and removed compared to the mercurial repository. You&#8217;ll see output like this:<\/p>\n<blockquote>\n<pre style=\"font-size: 90%;\">M toolkit\/crashreporter\/crashreporter.ini\r\nM toolkit\/defines.inc\r\n! browser\/README.txt\r\n! toolkit\/chrome\/mozapps\/xpinstall\/xpinstallConfirm.properties\r\n? browser\/branding\/official\/brand.dtd\r\n? browser\/branding\/official\/brand.properties<\/pre>\n<\/blockquote>\n<p>What does the output mean? It&#8217;s actually rather straight forward to interpret.<\/p>\n<ul>\n<li><code style=\"font-size: 100%;\">M<\/code> = Modified<\/li>\n<li><code style=\"font-size: 100%;\">!<\/code> = Missing<\/li>\n<li><code style=\"font-size: 100%;\">?<\/code> = Hg doesn&#8217;t know about this file<\/li>\n<li><code style=\"font-size: 100%;\">A<\/code> = Added to your local repo<\/li>\n<li><code style=\"font-size: 100%;\">R<\/code> = Removed by running <code style=\"font-size: 100%;\">hg remove<\/code><\/li>\n<\/ul>\n<p>You&#8217;ll use the printed status output to evaluate what areas of your local repository need to be cleaned up before committing to your hg locale repo.<\/p>\n<p>Here are issues to keep your eye on within your status output:<\/p>\n<ul>\n<li>Clean up files ending in <code style=\"font-size: 100%;\">.orig<\/code>. These are most commonly labeled as <code style=\"font-size: 100%;\">?<\/code> in your status output and must be removed. You can find these by either running this command:<\/li>\n<\/ul>\n<blockquote>\n<pre style=\"font-size: 100%;\"><code>find . -name \\*.orig -exec rm \\{\\} \\;<\/code><\/pre>\n<\/blockquote>\n<p>or copying and pasting your output from the command line to your favorite text<br \/>\neditor and using its <strong>Find<\/strong> function, then removing those files by drag and drop.<\/p>\n<ul>\n<li>Revert your <code style=\"font-size: 100%;\">region.properties<\/code> file and search plugins (if needed) by running this command:<\/li>\n<\/ul>\n<blockquote>\n<pre style=\"font-size: 100%;\"><code>hg revert -C -r default browser\/chrome\/browser-region browser\/searchplugins<\/code><\/pre>\n<\/blockquote>\n<ul>\n<li>Check for accessibility errors and <code style=\"font-size: 100%;\">&amp;amp;<\/code> in <code style=\"font-size: 100%;\">.properties<\/code> files. The problem here is that Narro exported <code style=\"font-size: 100%;\">.properties<\/code> files consider the <code style=\"font-size: 100%;\">&amp;<\/code> character to denote an access key, thus Narro removes it from HTML fragments and breaks entity references, like <code style=\"font-size: 100%;\">&amp;amp;<\/code>. You&#8217;ll have to manually make these changes in your favorite text editor.<\/li>\n<\/ul>\n<blockquote>\n<pre style=\"font-size: 100%;\"><code>hg diff dom\/chrome\/layout\/htmlparser.properties browser\/chrome\/browser\/quitDialog.properties browser\/chrome\/browser-region\/region.properties browser\/installer\/custom.properties browser\/installer\/mui.properties browser\/installer\/override.properties toolkit\/chrome\/global\/commonDialogs.properties toolkit\/chrome\/passwordmgr\/passwordmgr.properties toolkit\/chrome\/search\/search.properties<\/code><\/pre>\n<\/blockquote>\n<ul>\n<li>Revert the files that Narro likes to break (found in the command below). If you had actual L10n work in them, you&#8217;ll need to manually fix those files in your favorite text editor. If you don&#8217;t have L10n work in them, run the <code style=\"font-size: 100%;\">hg revert<\/code> command on them:<\/li>\n<\/ul>\n<blockquote>\n<pre style=\"font-size: 100%;\"><code>hg revert -r default dom\/chrome\/layout\/htmlparser.properties\u00a0 browser\/chrome\/browser\/quitDialog.properties\u00a0 browser\/chrome\/browser-region\/region.properties\u00a0 browser\/installer\/custom.properties browser\/installer\/mui.properties\u00a0 browser\/installer\/override.properties\u00a0 toolkit\/chrome\/global\/commonDialogs.properties\u00a0 toolkit\/chrome\/passwordmgr\/passwordmgr.properties\u00a0 toolkit\/chrome\/search\/search.properties<\/code><\/pre>\n<\/blockquote>\n<p>Some final notes:<\/p>\n<ul>\n<li>Be sure you have a non-broken starting point on your computer before you clean up your export files, otherwise your diff will be corrupted and then you&#8217;ll really be in a bad spot. <a href=\"https:\/\/l10n.mozilla.org\/source\/diff\/?from=b86699a22142&amp;to=85bf50c13957&amp;repo=releases%2Fl10n%2Fmozilla-aurora%2Fkm\">https:\/\/l10n.mozilla.org\/source\/diff\/?from=b86699a22142&amp;to=85bf50c13957&amp;repo=releases%2Fl10n%2Fmozilla-aurora%2Fkm<\/a> shows an example in a few of those (above files).<\/li>\n<\/ul>\n<ul>\n<li>If your last commit was already broken, <code style=\"font-size: 100%;\">hg diff<\/code> will miss that Narro has dropped the <code style=\"font-size: 100%;\">&amp;<\/code> character or even misplaced it (e.g., <code style=\"font-size: 100%;\">$Brand&amp;ShortName<\/code>), thus breaking HTML and accessibility. Be diligent and detail-oriented while looking through files to correct accessibility issues.<\/li>\n<\/ul>\n<div>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0 For example, you may see something like below and notice that it is missing its <code style=\"font-size: 100%;\"> &amp;<\/code><br \/>\ncharacter in the localized string.<\/p>\n<pre style=\"font-size: 100%;\">   CONTEXT_OPTIONS \u179a\u1794\u17c0\u1794\u179f\u17bb\u179c\u178f\u17d2\u1790\u17b7\u1797\u17b6\u1796 $Brand&amp;ShortName<\/pre>\n<\/div>\n<ul>\n<li>Please remember that these issues are currently being investigated. If you have any problems with these, please ask for help on the <a href=\"irc:\/\/irc.mozilla.org\/l10n\">#l10n IRC channel<\/a> or in the <a href=\"http:\/\/groups.google.com\/group\/mozilla.dev.l10n\/topics\">m.d.l10n newsgroup<\/a>. If you find additional bugs with Narro, feel free to file a bug in Bugzilla.<\/li>\n<\/ul>\n<p>Additional resources:<\/p>\n<ul>\n<li><a href=\"http:\/\/hgbook.red-bean.com\/read\/mercurial-in-daily-use.html\">http:\/\/hgbook.red-bean.com\/read\/mercurial-in-daily-use.html<\/a><\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/en\/Localizing_with_Narro\/Intermediate_tutorial\">https:\/\/developer.mozilla.org\/en\/Localizing_with_Narro\/Intermediate_tutorial<\/a><\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/En\/L10n_on_Mercurial\">https:\/\/developer.mozilla.org\/En\/L10n_on_Mercurial<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;ve ever used Narro to localize a project, you may have spent time cleaning up your exported files before they are committed to your locale&#8217;s repository. If you don&#8217;t &hellip; <a class=\"go\" href=\"https:\/\/blog.mozilla.org\/l10n\/2012\/07\/16\/tips-tricks-cleaning-up-narro-exports\/\">Read more<\/a><\/p>\n","protected":false},"author":385,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[614,199,610],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/l10n\/wp-json\/wp\/v2\/posts\/420"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/l10n\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/l10n\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/l10n\/wp-json\/wp\/v2\/users\/385"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/l10n\/wp-json\/wp\/v2\/comments?post=420"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/l10n\/wp-json\/wp\/v2\/posts\/420\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/l10n\/wp-json\/wp\/v2\/media?parent=420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/l10n\/wp-json\/wp\/v2\/categories?post=420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/l10n\/wp-json\/wp\/v2\/tags?post=420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}