]> git.parisson.com Git - pdf.js.git/commitdiff
Move localization to l10n folders; create 'make locale'
authorYury Delendik <ydelendik@mozilla.com>
Wed, 2 May 2012 13:51:52 +0000 (08:51 -0500)
committerYury Delendik <ydelendik@mozilla.com>
Wed, 2 May 2012 13:51:52 +0000 (08:51 -0500)
extensions/firefox/install.rdf
extensions/firefox/install.rdf.in
l10n/ar/metadata.inc [new file with mode: 0644]
l10n/ar/viewer.properties [new file with mode: 0644]
l10n/en-US/metadata.inc [new file with mode: 0644]
l10n/en-US/viewer.properties [new file with mode: 0644]
l10n/ru/metadata.inc [new file with mode: 0644]
l10n/ru/viewer.properties [new file with mode: 0644]
l10n/xx/viewer.properties [new file with mode: 0644]
make.js
web/locale.properties [deleted file]

index 0a0d813b2f37230220f24b9c4f80e84cf1844f6a..d7eea9319fff5c3880c341f5bdad8ec3d693c8cc 100644 (file)
@@ -5,6 +5,7 @@
 
   <Description about="urn:mozilla:install-manifest">
     <em:id>uriloader@pdf.js</em:id>
+    <!-- PDFJS_LOCALIZED_METADATA -->
     <em:name>PDF Viewer</em:name>
     <em:version>PDFJSSCRIPT_VERSION</em:version>
     <em:targetApplication>
index feab3e7adb3a606aed63c88243bcd61601e6422a..084d6dc2d0daf655e7b5ded5a468e9c012b095e2 100644 (file)
@@ -7,6 +7,7 @@
 
   <Description about="urn:mozilla:install-manifest">
     <em:id>uriloader@pdf.js</em:id>
+    <!-- PDFJS_LOCALIZED_METADATA -->
     <em:name>PDF Viewer</em:name>
     <em:version>PDFJSSCRIPT_VERSION</em:version>
     <em:targetApplication>
diff --git a/l10n/ar/metadata.inc b/l10n/ar/metadata.inc
new file mode 100644 (file)
index 0000000..2ac0890
--- /dev/null
@@ -0,0 +1,8 @@
+    <em:localized>
+      <Description>
+        <em:locale>ar</em:locale>
+        <em:name>PDF Viewer</em:name>
+        <em:description>Uses HTML5 to display PDF files directly in Firefox.</em:description>
+      </Description>
+    </em:localized>
+
diff --git a/l10n/ar/viewer.properties b/l10n/ar/viewer.properties
new file mode 100644 (file)
index 0000000..1bacbb6
--- /dev/null
@@ -0,0 +1,30 @@
+bookmark.title=الحالية عرض (نسخة أو في فتح نافذة جديدة)‬
+previous.title=سابق‬
+next.title=التالي‬
+print.title=طباعة‬
+download.title=تحميل‬
+zoom_out.title=التصغير‬
+zoom_in.title=تكبير‬
+error_more_info=مزيد من المعلومات‬
+error_less_info=أقل المعلومات‬
+error_close=أغلق‬
+error_build=PDF.JS البناء: ‬{{build}}
+error_message=الرسالة: ‬{{message}}
+error_stack=المكدس: ‬{{stack}}
+error_file=ملف:‬ {{file}}
+error_line=خط: ‬{{line}}
+page_scale_width=صفحة العرض‬
+page_scale_fit=صفحة صالح‬
+page_scale_auto=التلقائي تكبير‬
+page_scale_actual=الحجم الفعلي‬
+toggle_slider.title=تبديل المتزلج‬
+thumbs.title=وتظهر الصور المصغرة‬
+outline.title=عرض المخطط التفصيلي وثيقة‬
+loading=تحميل ... {{percent}}٪ في المئة‬
+loading_error_indicator=خطأ‬
+loading_error=حدث خطأ أثناء تحميل قوات الدفاع الشعبي.‬
+rendering_error=حدث خطأ في حين جعل صفحة.‬
+page_label=الصفحة:‬
+page_of=من {{pageCount}}‬
+no_outline=لا مخطط متاح‬
+
diff --git a/l10n/en-US/metadata.inc b/l10n/en-US/metadata.inc
new file mode 100644 (file)
index 0000000..8d9d94b
--- /dev/null
@@ -0,0 +1,8 @@
+    <em:localized>
+      <Description>
+        <em:locale>en-US</em:locale>
+        <em:name>PDF Viewer</em:name>
+        <em:description>Uses HTML5 to display PDF files directly in Firefox.</em:description>
+      </Description>
+    </em:localized>
+
diff --git a/l10n/en-US/viewer.properties b/l10n/en-US/viewer.properties
new file mode 100644 (file)
index 0000000..6c5dfde
--- /dev/null
@@ -0,0 +1,30 @@
+bookmark.title=Current view (copy or open in new window)
+previous.title=Previous
+next.title=Next
+print.title=Print
+download.title=Download
+zoom_out.title=Zoom Out
+zoom_in.title=Zoom In
+error_more_info=More Information
+error_less_info=Less Information
+error_close=Close
+error_build=PDF.JS Build: {{build}}
+error_message=Message: {{message}}
+error_stack=Stack: {{stack}}
+error_file=File: {{file}}
+error_line=Line: {{line}}
+page_scale_width=Page Width
+page_scale_fit=Page Fit
+page_scale_auto=Automatic Zoom
+page_scale_actual=Actual Size
+toggle_slider.title=Toggle Slider
+thumbs.title=Show Thumbnails
+outline.title=Show Document Outline
+loading=Loading... {{percent}}%
+loading_error_indicator=Error
+loading_error=An error occurred while loading the PDF.
+rendering_error=An error occurred while rendering the page.
+page_label=Page:
+page_of=of {{pageCount}}
+no_outline=No Outline Available
+
diff --git a/l10n/ru/metadata.inc b/l10n/ru/metadata.inc
new file mode 100644 (file)
index 0000000..410814c
--- /dev/null
@@ -0,0 +1,8 @@
+    <em:localized>
+      <Description>
+        <em:locale>ru</em:locale>
+        <em:name>PDF Viewer</em:name>
+        <em:description>Показывает файлы PDF непосредственно в Firefox используя HTML5.</em:description>
+      </Description>
+    </em:localized>
+
diff --git a/l10n/ru/viewer.properties b/l10n/ru/viewer.properties
new file mode 100644 (file)
index 0000000..44c8e5d
--- /dev/null
@@ -0,0 +1,30 @@
+bookmark.title=Ссылка на текущий вид (скопировать или открыть в новом окне) 
+previous.title=Предыдущая
+next.title=Следующая
+print.title=Печать
+download.title=Загрузить
+zoom_out.title=Уменьшить
+zoom_in.title=Увеличить
+error_more_info=Больше информации
+error_less_info=Меньше информации
+error_close=Закрыть
+error_build=PDF.JS компиляция: {{build}}
+error_message=Сообщение: {{message}}
+error_stack=Стeк: {{stack}}
+error_file=Файл: {{file}}
+error_line=Строка: {{line}}
+page_scale_width=Ширина страницы
+page_scale_fit=Вся страница
+page_scale_auto=Автоматический
+page_scale_actual=Настоящий размер
+toggle_slider.title=Открыть/закрыть вспомогательную панель
+thumbs.title=Показать уменьшенные изображения
+outline.title=Показать содержание документа
+loading=Загрузка... {{percent}}%
+loading_error_indicator=Ошибка
+loading_error=Произошла ошибка во время загрузки PDF.
+rendering_error=Произошла ошибка во время создания страницы.
+page_label=Страница:
+page_of=из {{pageCount}}
+no_outline=Содержание не доступно
+
diff --git a/l10n/xx/viewer.properties b/l10n/xx/viewer.properties
new file mode 100644 (file)
index 0000000..5a217ff
--- /dev/null
@@ -0,0 +1,29 @@
+bookmark.title=<<<_¢ȗггεпţ ṿiεẂ (¢OÞӳ Oг OÞεп iп пεẂ ẂiпÐOẂ)_>>>
+previous.title=<<<_ÞгεṿiOȗ§_>>>
+next.title=<<<_пεӾţ_>>>
+print.title=<<<_Þгiпţ_>>>
+download.title=<<<_ÐOẂпḻOãÐ_>>>
+zoom_out.title=<<<_ƩOOм Oȗţ_>>>
+zoom_in.title=<<<_ƩOOм iп_>>>
+error_more_info=<<<_мOгε iп£OгмãţiOп_>>>
+error_less_info=<<<_ḻε§§ iп£OгмãţiOп_>>>
+error_close=<<<_¢ḻO§ε_>>>
+error_build=<<<_ÞУ.ʃ§ ьȗiḻÐ: {{build}}_>>>
+error_message=<<<_мε§§ãģε: {{message}}_>>>
+error_stack=<<<_§ţã¢қ: {{stack}}_>>>
+error_file=<<<_£iḻε: {{file}}_>>>
+error_line=<<<_ḻiпε: {{line}}_>>>
+page_scale_width=<<<_Þãģε ẂiÐţН_>>>
+page_scale_fit=<<<_Þãģε £iţ_>>>
+page_scale_auto=<<<_ãȗţOмãţi¢ ƩOOм_>>>
+page_scale_actual=<<<_ã¢ţȗãḻ §iƩε_>>>
+toggle_slider.title=<<<_ţOģģḻε §ḻiÐεг_>>>
+thumbs.title=<<<_§НOẂ ţНȗмьпãiḻ§_>>>
+outline.title=<<<_§НOẂ ÐO¢ȗмεпţ Oȗţḻiпε_>>>
+loading=<<<_ḻOãÐiпģ... {{percent}}%_>>>
+loading_error_indicator=<<<_εггOг_>>>
+loading_error=<<<_ãп εггOг O¢¢ȗггεРẂНiḻε ḻOãÐiпģ ţНε ÞУ._>>>
+rendering_error=<<<_ãп εггOг O¢¢ȗггεРẂНiḻε гεпÐεгiпģ ţНε Þãģε._>>>
+page_label=Þãģε:
+page_of=<<<_O£ {{pageCount}}_>>>
+no_outline=<<<_пO Oȗţḻiпε ãṿãiḻãьḻε_>>>
diff --git a/make.js b/make.js
index 8c1319554f10d05ceeceed90a860a617b12104e5..d6caa53c1163057159760cbb01bd3a51775ccb15 100755 (executable)
--- a/make.js
+++ b/make.js
@@ -33,6 +33,7 @@ target.all = function() {
 //
 target.web = function() {
   target.production();
+  target.locale();
   target.extension();
   target.pagesrepo();
 
@@ -61,6 +62,52 @@ target.web = function() {
     " and issue 'git commit' to push changes.");
 };
 
+//
+// make locale
+// Creates localized resources for the viewer and extension.
+//
+target.locale = function() {
+  var L10N_PATH = 'l10n';
+  var METADATA_OUTPUT = 'extensions/firefox/metadata.inc';
+  var VIEWER_OUTPUT = 'web/locale.properties';
+  var DEFAULT_LOCALE = 'en-US';
+
+  cd(ROOT_DIR);
+  echo();
+  echo('### Building localization files');
+
+  var subfolders = ls(L10N_PATH);
+  subfolders.sort();
+  var metadataContent = '';
+  var viewerOutput = '';
+  for (var i = 0; i < subfolders.length; i++) {
+    var locale = subfolders[i];
+    var path = L10N_PATH + '/' + locale;
+    if (!test('-d', path))
+      continue;
+
+    if (!/^[a-z][a-z](-[A-Z][A-Z])?$/.test(locale)) {
+      echo('Skipping invalid locale: ' + locale);
+      continue;
+    }
+
+    if (test('-f', path + '/viewer.properties')) {
+      var properties = cat(path + '/viewer.properties');
+      if (locale == DEFAULT_LOCALE)
+        viewerOutput = '[*]\n' + properties + '\n' + viewerOutput;
+      else
+        viewerOutput = viewerOutput + '[' + locale + ']\n' + properties + '\n';
+    }
+
+    if (test('-f', path + '/metadata.inc')) {
+      var metadata = cat(path + '/metadata.inc');
+      metadataContent += metadata;
+    }
+  }
+  viewerOutput.to(VIEWER_OUTPUT);
+  metadataContent.to(METADATA_OUTPUT);
+};
+
 //
 // make production
 // Creates production output (pdf.js, and corresponding changes to web/ files)
@@ -302,6 +349,11 @@ target.firefox = function() {
   sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION, FIREFOX_BUILD_DIR + '/install.rdf.in');
   sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION, FIREFOX_BUILD_DIR + '/README.mozilla');
 
+  // Update localized metadata
+  var localizedMetadata = cat(EXTENSION_SRC_DIR + '/firefox/metadata.inc');
+  sed('-i', /.*PDFJS_LOCALIZED_METADATA.*\n/, localizedMetadata, FIREFOX_BUILD_DIR + '/install.rdf');
+  sed('-i', /.*PDFJS_LOCALIZED_METADATA.*\n/, localizedMetadata, FIREFOX_BUILD_DIR + '/install.rdf.in');
+
   // Create the xpi
   cd(FIREFOX_BUILD_DIR);
   exec('zip -r ' + FIREFOX_EXTENSION_NAME + ' ' + FIREFOX_EXTENSION_FILES.join(' '));
diff --git a/web/locale.properties b/web/locale.properties
deleted file mode 100644 (file)
index 1872e4f..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-[*]
-bookmark.title=Current view (copy or open in new window)
-previous.title=Previous
-next.title=Next
-print.title=Print
-download.title=Download
-zoom_out.title=Zoom Out
-zoom_in.title=Zoom In
-error_more_info=More Information
-error_less_info=Less Information
-error_close=Close
-error_build=PDF.JS Build: {{build}}
-error_message=Message: {{message}}
-error_stack=Stack: {{stack}}
-error_file=File: {{file}}
-error_line=Line: {{line}}
-page_scale_width=Page Width
-page_scale_fit=Page Fit
-page_scale_auto=Automatic Zoom
-page_scale_actual=Actual Size
-toggle_slider.title=Toggle Slider
-thumbs.title=Show Thumbnails
-outline.title=Show Document Outline
-loading=Loading... {{percent}}%
-loading_error_indicator=Error
-loading_error=An error occurred while loading the PDF.
-rendering_error=An error occurred while rendering the page.
-page_label=Page:
-page_of=of {{pageCount}}
-no_outline=No Outline Available
-
-[ar]
-bookmark.title=الحالية عرض (نسخة أو في فتح نافذة جديدة)‬
-previous.title=سابق‬
-next.title=التالي‬
-print.title=طباعة‬
-download.title=تحميل‬
-zoom_out.title=التصغير‬
-zoom_in.title=تكبير‬
-error_more_info=مزيد من المعلومات‬
-error_less_info=أقل المعلومات‬
-error_close=أغلق‬
-error_build=PDF.JS البناء: ‬{{build}}
-error_message=الرسالة: ‬{{message}}
-error_stack=المكدس: ‬{{stack}}
-error_file=ملف:‬ {{file}}
-error_line=خط: ‬{{line}}
-page_scale_width=صفحة العرض‬
-page_scale_fit=صفحة صالح‬
-page_scale_auto=التلقائي تكبير‬
-page_scale_actual=الحجم الفعلي‬
-toggle_slider.title=تبديل المتزلج‬
-thumbs.title=وتظهر الصور المصغرة‬
-outline.title=عرض المخطط التفصيلي وثيقة‬
-loading=تحميل ... {{percent}}٪ في المئة‬
-loading_error_indicator=خطأ‬
-loading_error=حدث خطأ أثناء تحميل قوات الدفاع الشعبي.‬
-rendering_error=حدث خطأ في حين جعل صفحة.‬
-page_label=الصفحة:‬
-page_of=من {{pageCount}}‬
-no_outline=لا مخطط متاح‬
-
-[ru]
-bookmark.title=Ссылка на текущий вид (скопировать или открыть в новом окне) 
-previous.title=Предыдущая
-next.title=Следующая
-print.title=Печать
-download.title=Загрузить
-zoom_out.title=Уменьшить
-zoom_in.title=Увеличить
-error_more_info=Больше информации
-error_less_info=Меньше информации
-error_close=Закрыть
-error_build=PDF.JS компиляция: {{build}}
-error_message=Сообщение: {{message}}
-error_stack=Стeк: {{stack}}
-error_file=Файл: {{file}}
-error_line=Строка: {{line}}
-page_scale_width=Ширина страницы
-page_scale_fit=Вся страница
-page_scale_auto=Автоматический
-page_scale_actual=Настоящий размер
-toggle_slider.title=Открыть/закрыть вспомогательную панель
-thumbs.title=Показать уменьшенные изображения
-outline.title=Показать содержание документа
-loading=Загрузка... {{percent}}%
-loading_error_indicator=Ошибка
-loading_error=Произошла ошибка во время загрузки PDF.
-rendering_error=Произошла ошибка во время создания страницы.
-page_label=Страница:
-page_of=из {{pageCount}}
-no_outline=Содержание не доступно
-
-[xx]
-bookmark.title=<<<_¢ȗггεпţ ṿiεẂ (¢OÞӳ Oг OÞεп iп пεẂ ẂiпÐOẂ)_>>>
-previous.title=<<<_ÞгεṿiOȗ§_>>>
-next.title=<<<_пεӾţ_>>>
-print.title=<<<_Þгiпţ_>>>
-download.title=<<<_ÐOẂпḻOãÐ_>>>
-zoom_out.title=<<<_ƩOOм Oȗţ_>>>
-zoom_in.title=<<<_ƩOOм iп_>>>
-error_more_info=<<<_мOгε iп£OгмãţiOп_>>>
-error_less_info=<<<_ḻε§§ iп£OгмãţiOп_>>>
-error_close=<<<_¢ḻO§ε_>>>
-error_build=<<<_ÞУ.ʃ§ ьȗiḻÐ: {{build}}_>>>
-error_message=<<<_мε§§ãģε: {{message}}_>>>
-error_stack=<<<_§ţã¢қ: {{stack}}_>>>
-error_file=<<<_£iḻε: {{file}}_>>>
-error_line=<<<_ḻiпε: {{line}}_>>>
-page_scale_width=<<<_Þãģε ẂiÐţН_>>>
-page_scale_fit=<<<_Þãģε £iţ_>>>
-page_scale_auto=<<<_ãȗţOмãţi¢ ƩOOм_>>>
-page_scale_actual=<<<_ã¢ţȗãḻ §iƩε_>>>
-toggle_slider.title=<<<_ţOģģḻε §ḻiÐεг_>>>
-thumbs.title=<<<_§НOẂ ţНȗмьпãiḻ§_>>>
-outline.title=<<<_§НOẂ ÐO¢ȗмεпţ Oȗţḻiпε_>>>
-loading=<<<_ḻOãÐiпģ... {{percent}}%_>>>
-loading_error_indicator=<<<_εггOг_>>>
-loading_error=<<<_ãп εггOг O¢¢ȗггεРẂНiḻε ḻOãÐiпģ ţНε ÞУ._>>>
-rendering_error=<<<_ãп εггOг O¢¢ȗггεРẂНiḻε гεпÐεгiпģ ţНε Þãģε._>>>
-page_label=Þãģε:
-page_of=<<<_O£ {{pageCount}}_>>>
-no_outline=<<<_пO Oȗţḻiпε ãṿãiḻãьḻε_>>>